Part Number Hot Search : 
OP193GBC 2N6230 XL2009 B1412 51125A SMBJ300 KA2271 40102
Product Description
Full Text Search
 

To Download EFM32WG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 1 www.energymicro.com EFM32WG reference manual wonder gecko series preliminary ? 32-bit arm cortex-m4 processor running at up to 48 ? up to 256 kb flash and 32 kb ram memory ? energy efficient and autonomous peripherals ? ultra low power energy modes with sub-a operation ? fast wake-up time of only 2 s the EFM32WG microcontroller series revolutionizes the 8- to 32-bit market with a combination of unmatched performance, and ultra low power consumption in both active- and sleep modes. EFM32WG devices consume as little as 230 a/mhz in run mode. EFM32WG's low energy consumption outperforms any other available 8-, 16-, and 32-bit solution. the EFM32WG includes autonomous and energy efficient peripherals, high overall chip- and analog integration, and the performance of the industry standard 32-bit arm cortex-m4 processor.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 2 www.energymicro.com 1 energy friendly microcontrollers 1.1 typical applications the EFM32WG wonder gecko is the ideal choice for demanding 8-, 16-, and 32-bit energy sensitive applications. these devices are developed to minimize the energy consumption by lowering both the power and the active time, over all phases of mcu operation. this unique combination of ultra low energy consumption and the performance of the 32-bit arm cortex-m4 processor, help designers get more out of the available energy in a variety of applications. ultra low energy EFM32WG microcontrollers are perfect for: ? gas metering ? energy metering ? water metering ? smart metering ? alarm and security systems ? health and fitness applications ? industrial and home automation 0 1 2 3 4 1.2 EFM32WG development because EFM32WG use the cortex-m4 cpu, embedded designers benefit from the largest development ecosystem in the industry, the arm ecosystem. the development suite spans the whole design process and includes powerful debug tools, and some of the world?s top brand compilers. libraries with documentation and user examples shorten time from idea to market. the range of EFM32WG devices ensure easy migration and feature upgrade possibilities.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 3 www.energymicro.com 2 about this document this document contains reference material for the EFM32WG series of microcontrollers. all modules and peripherals in the EFM32WG series devices are described in general terms. not all modules are present in all devices, and the feature set for each device might vary. such differences, including pin- out, are covered in the device-specific datasheets. 2.1 conventions register names register names are given as a module name prefix followed by the short register name: timern_ctrl - control register the "n" denotes the numeric instance for modules that might have more than one instance. some registers are grouped which leads to a group name following the module prefix: gpio_px_dout - port data out register, where x denotes the port instance (a,b,...). bit fields registers contain one or more bit fields which can be 1 to 32 bits wide. multi-bit fields are denoted with (x:y), where x is the start bit and y is the end bit. address the address for each register can be found by adding the base address of the module (found in the memory map), and the offset address for the register (found in module register map). access type the register access types used in the register descriptions are explained in table 2.1 (p. 3 ) . table 2.1. register access types access type description r read only. writes are ignored. rw readable and writable. rw1 readable and writable. only writes to 1 have effect. w1 read value undefined. only writes to 1 have effect. w write only. read value undefined. rwh readable, writable and updated by hardware. number format 0x prefix is used for hexadecimal numbers. 0b prefix is used for binary numbers. numbers without prefix are in decimal representation. reserved
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 4 www.energymicro.com registers and bit fields marked with reserved are reserved for future use. these should be written to 0 unless otherwise stated in the register description. reserved bits might be read as 1 in future devices. reset value the reset value denotes the value after reset. registers denoted with x have an unknown reset value and need to be initialized before use. note that, before these registers are initialized, read-modify-write operations might result in undefined register values. pin connections pin connections are given as a module prefix followed by a short pin name: usn_tx (usartn tx pin) the pin locations referenced in this document are given in the device-specific datasheet. 2.2 related documentation further documentation on the EFM32WG family and the arm cortex-m4 can be found at the energy micro and arm web pages: www.energymicro.com www.arm.com
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 5 www.energymicro.com 3 system overview 3.1 introduction the efm32 mcus are the world?s most energy friendly microcontrollers. with a unique combination of the powerful 32-bit arm cortex-m4, innovative low energy techniques, short wake-up time from energy saving modes, and a wide selection of peripherals, the EFM32WG microcontroller is well suited for any battery operated application, as well as other systems requiring high performance and low-energy consumption, see figure 3.1 (p. 7 ) . 3.2 features ? arm cortex-m4 cpu platform ? high performance 32-bit processor @ up to 48 ? dsp instruction support and floating-point unit ? memory protection unit ? wake-up interrupt controller ? flexible energy management system ? 20 na @ 3 v shutoff mode ? 0.4a @ 3 v shutoff mode with rtc ? 0.65 a @ 3 v stop mode, including power-on reset, brown-out detector, ram and cpu retention ? 0.95 a @ 3 v deep sleep mode, including rtc with 32.768 khz oscillator, power-on reset, brown-out detector, ram and cpu retention ? 67 a/mhz @ 3 v sleep mode ? 230 a/mhz @ 3 v run mode, with code executed from flash ? 256/128/64 kb flash ? 32 kb ram ? up to 93 general purpose i/o pins ? configurable push-pull, open-drain, pull-up/down, input filter, drive strength ? configurable peripheral i/o locations ? 16 asynchronous external interrupts ? output state retention and wake-up from shutoff mode ? 12 channel dma controller ? alternate/primary descriptors with scatter-gather/ping-pong operation ? 12 channel peripheral reflex system ? autonomous inter-peripheral signaling enables smart operation in low energy modes ? external bus interface (ebi) ? up to 4x256 mb of external memory mapped space ? tft controller supporting direct drive ? universal serial bus (usb) with host and otg support ? fully usb 2.0 compliant ? on-chip phy and embedded 5v to 3.3v regulator ? integrated lcd controller for up to 836 segments ? voltage boost, adjustable contrast adjustment and autonomous animation feature ? hardware aes with 128/256-bit keys in 54/75 cycles ? communication interfaces ? 3 universal synchronous/asynchronous receiver/transmitter ? uart/spi/smartcard (iso 7816)/irda (usart0)/i2s (usart1+usart2) ? triple buffered full/half-duplex operation ? 4-16 data bits ? 2 universal asynchronous receiver/transmitter
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 6 www.energymicro.com ? triple buffered full/half-duplex operation ? 8-9 data bits ? 2 low energy uart ? autonomous operation with dma in deep sleep mode ? 2 i 2 c interface with smbus support ? address recognition in stop mode ? timers/counters ? 4 16-bit timer/counter ? 3 compare/capture/pwm channels ? dead-time insertion on timer0 ? 16-bit low energy timer ? 1 24-bit and 1 32-bit real-time counter ? 3 16-bit pulse counter ? asynchronous pulse counting/quadrature decoding ? watchdog timer with dedicated rc oscillator @ 50 na ? backup power domain ? rtc and retention registers in a separate power domain, available in all energy modes ? operation from backup battery when main power drains out ? ultra low power precision analog peripherals ? 12-bit 1 msamples/s analog to digital converter ? 8 input channels and on-chip temperature sensor ? single ended or differential operation ? conversion tailgating for predictable latency ? 12-bit 500 ksamples/s digital to analog converter ? 2 single ended channels/1 differential channel ? up to 3 operational amplifiers ? supports rail-to-rail inputs and outputs ? programmable gain ? 2 analog comparator ? programmable speed/current ? capacitive sensing with up to 8 inputs ? supply voltage comparator ? ultra low power sensor interface ? autonomous sensor monitoring in deep sleep mode ? wide range of sensors supported, including lc sensors and capacitive buttons ? ultra efficient power-on reset and brown-out detector ? debug interface ? 2-pin serial wire debug interface ? 1-pin serial wire viewer ? embedded trace module v3.5 (etm) ? temperature range -40 - 85oc ? single power supply 1.85 - 3.8 v ? packages ? qfn64 ? tqfp64 ? lqfp100 ? lfbga112 ? vfbga120
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 7 www.energymicro.com 3.3 block diagram figure 3.1 (p. 7 ) shows the block diagram of EFM32WG. the color indicates peripheral availability in the different energy modes, described in section 3.4 (p. 7 ) . figure 3.1. block diagram of EFM32WG clock managem ent energy managem ent serial int erfaces i/o port s core and mem ory tim ers and triggers analog int erfaces securit y 32-bit bus peripheral reflex syst em arm cort ex? m4 processor wit h dsp ext ensions and fpu flash program mem ory lesense high freq. rc oscillat or high freq. cryst al oscillat or tim er/ count er low energy tim er pulse count er real tim e count er low freq. cryst al oscillat or low freq. rc oscillat or wat chdog tim er ram mem ory ext . bus int erface general purpose i/o mem ory prot ect ion unit dma cont roller debug int erface w/ etm ext ernal int errupt s pin reset hardware aes wonder gecko lcd cont roller adc dac operat ional am plifier usart i 2 c uart power-on reset volt age regulat or back-up power dom ain volt age com parat or brown-out det ect or tft driver back-up rtc usb analog com parat or low energy uart ? pin wakeup ult ra low freq. rc oscillat or figure 3.2. energy mode indicator 0 1 2 3 4 note in the energy mode indicator, the numbers indicates energy mode, i.e em0-em4. 3.4 energy modes there are five different energy modes (em0-em4) in the EFM32WG, see table 3.1 (p. 8 ) . the EFM32WG is designed to achieve a high degree of autonomous operation in low energy modes. the intelligent combination of peripherals, ram with data retention, dma, low-power oscillators, and short wake-up time, makes it attractive to remain in low energy modes for long periods and thus saving energy consumption.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 8 www.energymicro.com tip throughout this document, the first figure in every module description contains an energy mode indicator showing which energy mode(s) the module can operate (see table 3.1 (p. 8 ) ). table 3.1. energy mode description energy mode name description 0 1 2 3 4 em0 ? energy mode 0 (run mode) in em0, the cpu is running and consuming as little as 230 a/mhz, when running code from flash. all peripherals can be active. 0 1 2 3 4 em1 ? energy mode 1 (sleep mode) in em1, the cpu is sleeping and the power consumption is only 67 a/mhz. all peripherals, including dma, prs and memory system, are still available. 0 1 2 3 4 em2 ? energy mode 2 (deep sleep mode) in em2 the high frequency oscillator is turned off, but with the 32.768 khz oscillator running, selected low energy peripherals (lcd, rtc, letimer, pcnt, wdog, leuart, i 2 c, acmp , lesense , opamp , usb ) are still available. this gives a high degree of autonomous operation with a current consumption as low as 0.95 a with rtc enabled. power-on reset, brown- out detection and full ram and cpu retention is also included. 0 1 2 3 4 em3 - energy mode 3 (stop mode) in em3, the low-frequency oscillator is disabled, but there is still full cpu and ram retention, as well as power-on reset, pin reset , em4 wake-up and brown-out detection, with a consumption of only 0.65 a. the low-power acmp, asynchronous external interrupt, pcnt, and i 2 c can wake-up the device. even in this mode, the wake-up time is a few microseconds. 0 1 2 3 4 em4 ? energy mode 4 (shutoff mode) in em4, the current is down to 20 na and all chip functionality is turned off except the pin reset , gpio pin wake-up , gpio pin retention , backup rtc (including retention ram) and the power-on reset. all pins are put into their reset state. 3.5 product overview table 3.2 (p. 8 ) shows a device overview of the EFM32WG microcontroller series, including peripheral functionality. for more information, the reader is referred to the device specific datasheets. table 3.2. EFM32WG microcontroller series EFM32WG part # flash ram gpio(pins) usb lcd usart+uart leuart i 2 c timer(pwm) letimer rtc pcnt watchdog adc(pins) dac(pins) acmp(pins) aes ebi lesense op-amps package 230f64 64 32 56 - - 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y - y 3 qfn64 230f128 128 32 56 - - 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y - y 3 qfn64
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 9 www.energymicro.com EFM32WG part # flash ram gpio(pins) usb lcd usart+uart leuart i 2 c timer(pwm) letimer rtc pcnt watchdog adc(pins) dac(pins) acmp(pins) aes ebi lesense op-amps package 230f256 256 32 56 - - 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y - y 3 qfn64 232f64 64 32 53 - - 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 2 (16) y - y 3 qfp64 232f128 128 32 53 - - 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 2 (16) y - y 3 qfp64 232f256 256 32 53 - - 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 2 (16) y - y 3 qfp64 280f64 64 32 86 - - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 qfp100 280f128 128 32 86 - - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 qfp100 280f256 256 32 86 - - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 qfp100 290f64 64 32 90 - - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 bga112 290f128 128 32 90 - - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 bga112 290f256 256 32 90 - - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 bga112 295f64 64 32 93 - - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 bga120 295f128 128 32 93 - - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 bga120 295f256 256 32 93 - - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 bga120 330f64 64 32 53 y - 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y - y 3 qfn64 330f128 128 32 53 y - 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y - y 3 qfn64 330f256 256 32 53 y - 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y - y 3 qfn64 332f64 64 32 50 y - 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 2 (12) y - y 3 qfp64 332f128 128 32 50 y - 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 2 (12) y - y 3 qfp64 332f256 256 32 50 y - 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 2 (12) y - y 3 qfp64 380f64 64 32 83 y - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y y 3 qfp100 380f128 128 32 83 y - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y y 3 qfp100 380f256 256 32 83 y - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y y 3 qfp100 390f64 64 32 87 y - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y y 3 bga112 390f128 128 32 87 y - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y y 3 bga112 390f256 256 32 87 y - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y y 3 bga112 395f64 64 32 93 y - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 bga120
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 10 www.energymicro.com EFM32WG part # flash ram gpio(pins) usb lcd usart+uart leuart i 2 c timer(pwm) letimer rtc pcnt watchdog adc(pins) dac(pins) acmp(pins) aes ebi lesense op-amps package 395f128 128 32 93 y - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 bga120 395f256 256 32 93 y - 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y y 3 bga120 840f64 64 32 56 - 8x20 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (8) y - y 3 qfn64 840f128 128 32 56 - 8x20 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (8) y - y 3 qfn64 840f256 256 32 56 - 8x20 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (8) y - y 3 qfn64 842f64 64 32 53 - 8x18 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 2 (8) y - y 3 qfp64 842f128 128 32 53 - 8x18 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 2 (8) y - y 3 qfp64 842f256 256 32 53 - 8x18 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 2 (8) y - y 3 qfp64 880f64 64 32 86 - 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 qfp100 880f128 128 32 86 - 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 qfp100 880f256 256 32 86 - 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 qfp100 890f64 64 32 90 - 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 bga112 890f128 128 32 90 - 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 bga112 890f256 256 32 90 - 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 bga112 895f64 64 32 93 - 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 bga120 895f128 128 32 93 - 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 bga120 895f256 256 32 93 - 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 bga120 940f64 64 32 53 y 8x18 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 1 (4) y - y 3 qfn64 940f128 128 32 53 y 8x18 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 1 (4) y - y 3 qfn64 940f256 256 32 53 y 8x18 3 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 1 (4) y - y 3 qfn64 942f64 64 32 50 y 8x16 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 1 (4) y - y 3 qfp64 942f128 128 32 50 y 8x16 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 1 (4) y - y 3 qfp64 942f256 256 32 50 y 8x16 3 2 2 4 (11) 1 1 3 1 1 (8) 2 (2) 1 (4) y - y 3 qfp64 980f64 64 32 83 y 8x34 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y 1 y 3 lqfp100 980f128 128 32 83 y 8x34 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y 1 y 3 lqfp100 980f256 256 32 83 y 8x34 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y 1 y 3 lqfp100
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 11 www.energymicro.com EFM32WG part # flash ram gpio(pins) usb lcd usart+uart leuart i 2 c timer(pwm) letimer rtc pcnt watchdog adc(pins) dac(pins) acmp(pins) aes ebi lesense op-amps package 990f64 64 32 87 y 8x34 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y 1 y 3 lfbga112 990f128 128 32 87 y 8x34 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y 1 y 3 lfbga112 990f256 256 32 87 y 8x34 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (12) y y 1 y 3 lfbga112 995f64 64 32 93 y 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 vfbga120 995f128 128 32 93 y 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 vfbga120 995f256 256 32 93 y 8x36 3+2 2 2 4 (12) 1 1 3 1 1 (8) 2 (2) 2 (16) y y 1 y 3 vfbga120 1 ebi and lcd share pins in the part. only a reduced pin count lcd driver can be used simultaneously with the ebi.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 12 www.energymicro.com 4 system processor 0 1 2 3 4 cm 4 cor e 3 2 -b it alu cont rol logic dsp ext ensions inst ruct ion int erface dat a int erface nvic int erface single cycle 32 -bit m ult iplier hardware divider mem ory prot ect ion unit float ing-point unit thum b & thum b-2 decode quick facts what? the industry leading cortex-m4 processor from arm is the cpu in the EFM32WG microcontrollers. why? the arm cortex-m4 is designed for exceptional short response time, high code density, and high 32-bit throughput while maintaining a strict cost and power consumption budget. how? combined with the ultra low energy peripherals available, the cortex-m4 with floating-point unit (fpu) makes the EFM32WG devices perfect for 8- to 32- bit applications. the processor is featuring a harvard architecture, 3 stage pipeline, single cycle instructions, extended thumb-2 instruction set support, and fast interrupt handling. 4.1 introduction the arm cortex-m4 32-bit risc processor provides outstanding computational performance and exceptional system response to interrupts while meeting low cost requirements and low power consumption. the arm cortex-m4 implemented is revision r0p1. 4.2 features ? digital signal processor ? enhances speed and reduces the active time with dedicated dsp instructions ? harvard architecture ? separate data and program memory buses (no memory bottleneck as for a single-bus system) ? 3-stage pipeline ? thumb-2 instruction set ? enhanced levels of performance, energy efficiency, and code density ? single-precision floating-point unit ? enables embedded system designers to take full advantage of floating-points ? extends the instruction set with 28 floating-point instructions ? single-cycle multiply and efficient divide instructions ? 32-bit multiplication in a single cycle ? signed and unsigned divide operations between 2 and 12 cycles ? atomic bit manipulation with bit banding ? direct access to single bits of data ? two 1mb bit banding regions for memory and peripherals mapping to 32mb alias regions ? atomic operation which cannot be interrupted by other bus activities
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 13 www.energymicro.com ? 1.25 dmips/mhz ? memory protection unit ? up to 8 protected memory regions ? 24-bit system tick timer for real-time operating system (rtos) ? excellent 32-bit migration choice for 8/16 bit architecture based designs ? simplified stack-based programmer's model is compatible with traditional arm architecture and retains the programming simplicity of legacy 8- and 16-bit architectures ? unaligned data storage and access ? continuous storage of data requiring different byte lengths ? data access in a single core clock cycle ? integrated power modes ? sleep now mode for immediate transfer to low power state ? sleep on exit mode for entry into low power state after the servicing of an interrupt ? ability to extend power savings to other system components ? optimized for low latency, nested interrupts 4.3 functional description for a full functional description of the arm cortex-m4 (r0p1) implementation in the EFM32WG family, the reader is referred to the arm cortex-m4 devices generic user guide . 4.3.1 interrupt operation figure 4.1. interrupt operation module cort ex-m4 nvic ien[ n] if[ n] set clear ifs[ n] ifc[ n] int errupt condit ion irq setena[ n] /clrena[ n] int errupt request setpend[ n] /clrpend[ n] set clear act ive int errupt soft ware generat ed int errupt the EFM32WG devices have up to 31 interrupt request lines (irq) which are connected to the cortex- m4. each of these lines (shown in table 4.1 (p. 13 ) ) are connected to one or more interrupt flags in one or more modules. the interrupt flags are set by hardware on an interrupt condition. it is also possible to set/clear the interrupt flags through the ifs/ifc registers. each interrupt flag is then qualified with its own interrupt enable bit (ien register), before being or'ed with the other interrupt flags to generate the irq. a high irq line will set the corresponding pending bit (can also be set/cleared with the setpend/ clrpend bits in ispr0/icpr0) in the cortex-m4 nvic. the pending bit is then qualified with an enable bit (set/cleared with setena/clrena bits in iser0/icer0) before generating an interrupt request to the core. figure 4.1 (p. 13 ) illustrates the interrupt system. for more information on how the interrupts are handled inside the cortex-m4, the reader is referred to the arm cortex-m4 devices generic user guide . table 4.1. interrupt request lines (irq) irq # source 0 dma 1 gpio_even 2 timer0 3 usart0_rx 4 usart0_tx
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 14 www.energymicro.com irq # source 5 usb 6 acmp0/acmp1 7 adc0 8 dac0 9 i2c0 10 i2c1 11 gpio_odd 12 timer1 13 timer2 14 timer3 15 usart1_rx 16 usart1_tx 17 lesense 18 usart2_rx 19 usart2_tx 20 uart0_rx 21 uart0_tx 22 uart1_rx 23 uart1_tx 24 leuart0 25 leuart1 26 letimer0 27 pcnt0 28 pcnt1 29 pcnt2 30 rtc 31 burtc 32 cmu 33 vcmp 34 lcd 35 msc 36 aes 37 ebi 38 emu 39 fpueh
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 15 www.energymicro.com 5 memory and bus system 0 1 2 3 4 arm cor t e x-m 4 d m a con t r olle r ram pe r ip h e r a ls fla sh ebi quick facts what? a low latency memory system, including low energy flash and ram with data retention, makes extended use of low-power energy- modes possible. why? ram retention reduces the need for storing data in flash and enables frequent use of the ultra low energy modes em2 and em3 with as little as 0.65 a current consumption. how? low energy and non-volatile flash memory stores program and application data in all energy modes and can easily be reprogrammed in system. low leakage ram, with data retention in em0 to em3, removes the data restore time penalty, and the dma ensures fast autonomous transfers with predictable response time. 5.1 introduction the EFM32WG contains an amba ahb bus system allowing bus masters to access the memory mapped address space. a multilayer ahb bus matrix, using a round-robin arbitration scheme, connects the master bus interfaces to the ahb slaves ( figure 5.1 (p. 16 ) ). the bus matrix allows several ahb slaves to be accessed simultaneously. an amba apb interface is used for the peripherals, which are accessed through an ahb-to-apb bridge connected to the ahb bus matrix. the ahb bus masters are: ? cortex-m4 icode: used for instruction fetches from code memory (0x00000000 - 0x1fffffff). ? cortex-m4 dcode: used for debug and data access to code memory (0x00000000 - 0x1fffffff). ? cortex-m4 system: used for instruction fetches, data and debug access to system space (0x20000000 - 0xdfffffff). ? dma: can access entire memory space (0x00000000 - 0xdfffffff). ? usb dma: can access code space, sram and ebi (0x00000000 - 0x3fffffff, 0x80000000 - 0xdfffffff), and the peripherals: usb and aes.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 16 www.energymicro.com figure 5.1. EFM32WG bus system cort ex ahb mult ilayer bus mat rix dcode syst em usb dma flash ram ebi ahb/apb bridge icode aes peripheral 0 peripheral n dma usb 5.2 functional description the memory segments are mapped together with the internal segments of the cortex-m4 into the system memory map shown by figure 5.2 (p. 16 ) figure 5.2. system address space
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 17 www.energymicro.com the embedded sram is located at address 0x20000000 in the memory map of the EFM32WG. when running code located in sram starting at this address, the cortex-m4 uses the system bus to fetch instructions. this results in reduced performance as the cortex-m4 accesses stack, other data in sram and peripherals using the system bus. to be able to run code from sram efficiently, the sram is also mapped in the code space at address 0x10000000. when running code from this space, the cortex-m4 fetches instructions through the i/d-code bus interface, leaving the system bus for data access. the sram mapped into the code space can however only be accessed by the cpu, i.e. not the dma. 5.2.1 bit-banding the sram bit-band alias and peripheral bit-band alias regions are located at 0x22000000 and 0x42000000 respectively. read and write operations to these regions are converted into masked single- bit reads and atomic single-bit writes to the embedded sram and peripherals of the EFM32WG. the standard approach to modify a single register or sram bit in the aliased regions, requires software to read the value of the byte, half-word or word containing the bit, modify the bit, and then write the byte, half-word or word back to the register or sram address. using bit-banding, this can be done in a single operation. as read-writeback, bit-masking and bit-shift operations are not necessary in software, code size is reduced and execution speed improved. the bit-band regions allows addressing each individual bit in the sram and peripheral areas of the memory map. to set or clear a bit in the embedded sram, write a 1 or a 0 to the following address: memory sram area set/clear bit bit_address = 0x22000000 + ( address ? 0x20000000) 32 + bit 4, (5.1) where address is the address of the 32-bit word containing the bit to modify, and bit is the index of the bit in the 32-bit word. to modify a bit in the peripheral area, use the following address: memory peripheral area bit modification bit_address = 0x42000000 + ( address ? 0x40000000) 32 + bit 4, (5.2) where address and bit are defined as above. 5.2.2 peripherals the peripherals are mapped into the peripheral memory segment, each with a fixed size address range according to table 5.1 (p. 18 ) , table 5.2 (p. 19 ) and table 5.3 (p. 20 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 18 www.energymicro.com table 5.1. memory system core peripherals core peripherals address range peripheral 0x400e0400 ? 0x41ffffff reserved 0x400e0000 ? 0x400e03ff aes 0x400cc400 ? 0x400dffff reserved 0x400cc000 ? 0x400cc3ff prs 0x400ca400 ? 0x400cbfff reserved 0x400ca000 ? 0x400ca3ff rmu 0x400c8400 ? 0x400c9fff reserved 0x400c8000 ? 0x400c83ff cmu 0x400c6400 ? 0x400c7fff reserved 0x400c6000 ? 0x400c63ff emu 0x400c4400 ? 0x400c5fff reserved 0x400c4000 ? 0x400c43ff usb 0x400c2000 ? 0x400c3fff dma 0x400c1c00 ? 0x400c1fff fpueh 0x400c0400 ? 0x400c1bff reserved 0x400c0000 ? 0x400c03ff msc
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 19 www.energymicro.com table 5.2. memory system low energy peripherals low energy peripherals address range peripheral 0x4008c400 ? 0x400bffff reserved 0x4008c000 ? 0x4008c3ff lesense 0x4008a400 ? 0x4008bfff reserved 0x4008a000 ? 0x4008a3ff lcd 0x40088400 ? 0x40089fff reserved 0x40088000 ? 0x400883ff wdog 0x40086c00 ? 0x40087fff reserved 0x40086800 ? 0x40086bff pcnt2 0x40086400 ? 0x400867ff pcnt1 0x40086000 ? 0x400863ff pcnt0 0x40084800 ? 0x40085fff reserved 0x40084400 ? 0x400847ff leuart1 0x40084000 ? 0x400843ff leuart0 0x40082400 ? 0x40083fff reserved 0x40082000 ? 0x400823ff letimer0 0x40081400 ? 0x40081fff reserved 0x40081000 ? 0x400813ff bckrtc 0x40080400 ? 0x40080fff reserved 0x40080000 ? 0x400803ff rtc
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 20 www.energymicro.com table 5.3. memory system peripherals peripherals address range peripheral 0x40011000 ? 0x4007ffff reserved 0x40010c00 ? 0x40010fff timer3 0x40010800 ? 0x40010bff timer2 0x40010400 ? 0x400107ff timer1 0x40010000 ? 0x400103ff timer0 0x4000e800 ? 0x4000ffff reserved 0x4000e400 ? 0x4000e7ff uart1 0x4000e000 ? 0x4000e3ff uart0 0x4000cc00 ? 0x4000dfff reserved 0x4000c800 ? 0x4000cbff usart2 0x4000c400 ? 0x4000c7ff usart1 0x4000c000 ? 0x4000c3ff usart0 0x4000a800 ? 0x4000bfff reserved 0x4000a400 ? 0x4000a7ff i2c1 0x4000a000 ? 0x4000a3ff i2c0 0x40008400 ? 0x40009fff reserved 0x40008000 ? 0x400083ff ebi 0x40007000 ? 0x40007fff reserved 0x40006000 ? 0x40006fff gpio 0x40004400 ? 0x40005fff reserved 0x40004000 ? 0x400043ff dac0 0x40002400 ? 0x40003fff reserved 0x40002000 ? 0x400023ff adc0 0x40001800 ? 0x40001fff reserved 0x40001400 ? 0x400017ff acmp1 0x40001000 ? 0x400013ff acmp0 0x40000400 ? 0x40000fff reserved 0x40000000 - 0x400003ff vcmp 5.2.3 bus matrix the bus matrix connects the memory segments to the bus masters: ? code: cpu instruction or data fetches from the code space ? system: cpu read and write to the sram , ebi and peripherals ? dma: access to code space, sram , ebi and peripherals ? usb dma: access to ebi, sram and code space
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 21 www.energymicro.com 5.2.3.1 arbitration the bus matrix uses a round-robin arbitration algorithm which enables high throughput and low latency while starvation of simultaneous accesses to the same bus slave are eliminated. round-robin does not assign a fixed priority to each bus master. the arbiter does not insert any bus wait-states. 5.2.3.2 access performance the bus matrix is a multi-layer energy optimized amba ahb compliant bus with an internal bandwidth equal to 4 times a single ahb-bus. the bus matrix accepts new transfers initiated by each master in every clock cycle without inserting any wait-states. the slaves, however, may insert wait-states depending on their internal throughput and the clock frequency. the cortex-m4, the dma controller, and the peripherals run on clocks that can be prescaled separately. when accessing a peripheral which runs on a frequency equal to or faster than the hfcoreclk, the number of wait cycles per access, in addition to master arbitration, is given by: memory wait cycles with clock equal or faster than hfcoreclk n cycles = 2 + n slave cycles , (5.3) where n slave cycles is the wait cycles introduced by the slave. when accessing a peripheral running on a clock slower than the hfcoreclk, wait-cycles are introduced to allow the transfer to complete on the peripheral clock. the number of wait cycles per access, in addition to master arbitration, is given by: memory wait cycles with clock slower than cpu n cycles = (2 + n slave cycles ) x f hfcoreclk /f hfperclk , (5.4) where n slave cycles is the number of wait cycles introduced by the slave. more details on clocks and prescaling can be found in chapter 11 (p. 124 ) . 5.3 access to low energy peripherals (asynchronous registers) 5.3.1 introduction the low energy peripherals are capable of running when the high frequency oscillator and core system is powered off, i.e. in energy mode em2 and in some cases also em3. this enables the peripherals to perform tasks while the system energy consumption is minimal. the low energy peripherals are: ? liquid crystal display driver - lcd ? low energy timer - letimer ? low energy uart - leuart ? pulse counter - pcnt ? real time counter - rtc ? watchdog - wdog ? low energy sensor interface - lesense ? backup rtc - burtc
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 22 www.energymicro.com all low energy peripherals are memory mapped, with automatic data synchronization. because the low energy peripherals are running on clocks asynchronous to the core clock, there are some constraints on how register accesses can be done, as described in the following sections. 5.3.1.1 writing every low energy peripheral has one or more registers with data that needs to be synchronized into the low energy clock domain to maintain data consistency and predictable operation. there are two different synchronization mechanisms on the wonder gecko; immediate synchronization, and delayed synchronization. immediate synchronization is available for the rtc, letimer and lesense, and results in an immediate update of the target registers. delayed synchronization is used for the other low energy peripherals, and for these peripherals, a write operation requires 3 positive edges on the clock of the low energy peripheral being accessed. registers requiring synchronization are marked "asynchronous" in their description header. 5.3.1.1.1 delayed synchronization after writing data to a register which value is to be synchronized into the low energy peripheral using delayed synchronization, a corresponding busy flag in the _syncbusy register (e.g. lcd_syncbusy) is set. this flag is set as long as synchronization is in progress and is cleared upon completion. note subsequent writes to the same register before the corresponding busy flag is cleared is not supported. write before the busy flag is cleared may result in undefined behavior. in general, the syncbusy register only needs to be observed if there is a risk of multiple write access to a register (which must be prevented). it is not required to wait until the relevant flag in the syncbusy register is cleared after writing a register. e.g em2 can be entered immediately after writing a register. see figure 5.3 (p. 22 ) for a more detailed overview of the write operation. figure 5.3. write operation to low energy peripherals regist er 0 regist er 1 . . . regist er n synchronizer 0 synchronizer 1 . . . synchronizer n regist er 0 sync regist er 1 sync . . . regist er n sync writ e[ 0:n] syncbusy regist er 0 syncbusy regist er 1 . . . syncbusy regist er n set 0 set 1 set n freeze synchronizat ion done clear 0 clear 1 clear n core clock low frequency clock low frequency clock core clock dom ain low frequency clock dom ain 5.3.1.1.2 immediate synchronization opposed to peripherals with delayed synchronization, data written to peripherals with immediate synchronization, takes effect in the peripheral immediately. they are updated immediately on the
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 23 www.energymicro.com peripheral write access. if a write is set up close to a peripheral clock edge, the write is delayed to after the clock edge. this will introduce wait-states on peripheral access. for peripherals with delayed synchronization, the syncbusy registers are still present and serve two purposes: (1) commands written to a peripheral with immediate synchronization are not executed before the first peripheral clock after the write. during this period, the syncbusy flag in the command register is set, indicating that the command has not yet been executed; (2) to maintain backwards compatibility with the efm32g series, syncbusy registers are also present for other registers. these are however, always 0, indicating that register writes are always safe. note if the application must be compatible with the efm32g series, all low energy peripherals should be accessed as if they only had delayed synchronization, i.e. using syncbusy. 5.3.1.2 reading when reading from low energy peripherals, the data is synchronized regardless of the originating clock domain. registers updated/maintained by the low energy peripheral are read directly from the low energy clock domain. registers residing in the core clock domain, are read from the core clock domain. see figure 5.4 (p. 23 ) for a more detailed overview of the read operation. note writing a register and then immediately reading back the value of the register may give the impression that the write operation is complete. this is not necessarily the case. please refer to the syncbusy register for correct status of the write operation to the low energy peripheral. figure 5.4. read operation from low energy peripherals regist er 0 regist er 1 . . . regist er n synchronizer 0 synchronizer 1 . . . synchronizer n regist er 0 sync regist er 1 sync . . . regist er n sync freeze core clock low frequency clock low frequency clock core clock dom ain low frequency clock dom ain low energy peripheral main funct ion hw st at us regist er 0 hw st at us regist er 1 . . . hw st at us regist er m read synchronizer read dat a 5.3.2 freeze register for low energy peripherals with delayed synchronization there is a _freeze register (e.g. rtc_freeze), containing a bit named regfreeze. if precise control of the synchronization process is required, this bit may be utilized. when regfreeze is set, the synchronization process is halted, allowing the software to write multiple low energy registers before starting the synchronization process, thus providing precise control of the module update process. the synchronization process is started by clearing the regfreeze bit.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 24 www.energymicro.com note the freeze register is also present on peripherals with immediate synchronization, but has no effect. 5.4 flash the flash retains data in any state and typically stores the application code, special user data and security information. the flash memory is typically programmed through the debug interface, but can also be erased and written to from software. ? up to 256 kb of memory ? page size of 2048 bytes (minimum erase unit) ? minimum 20 000 erase cycles ? more than 10 years data retention at 85c ? lock-bits for memory protection ? data retention in any state 5.5 sram the primary task of the sram memory is to store application data. additionally, it is possible to execute instructions from sram, and the dma may used to transfer data between the sram, flash and peripherals. ? up to 32 kb memory ? bit-band access support ? data retention of the entire memory in em0 to em3 5.6 device information (di) page the di page contains calibration values, a unique identification number and other useful data. see the table below for a complete overview. table 5.4. device information page contents di address register description 0x0fe08020 cmu_lfrcoctrl register reset value. 0x0fe08028 cmu_hfrcoctrl register reset value. 0x0fe08030 cmu_auxhfrcoctrl register reset value. 0x0fe08040 adc0_cal register reset value. 0x0fe08048 adc0_biasprog register reset value. 0x0fe08050 dac0_cal register reset value. 0x0fe08058 dac0_biasprog register reset value. 0x0fe08060 acmp0_ctrl register reset value. 0x0fe08068 acmp1_ctrl register reset value. 0x0fe08078 cmu_lcdctrl register reset value. 0x0fe080a0 dac0_opactrl register reset value. 0x0fe080a8 dac0_opaoffset register reset value. 0x0fe081b0 di_crc [15:0]: di data crc-16. 0x0fe081b2 cal_temp_0 [7:0] calibration temperature (c).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 25 www.energymicro.com di address register description 0x0fe081b4 adc0_cal_1v25 [14:8]: gain for 1v25 reference, [6:0]: offset for 1v25 reference. 0x0fe081b6 adc0_cal_2v5 [14:8]: gain for 2v5 reference, [6:0]: offset for 2v5 reference. 0x0fe081b8 adc0_cal_vdd [14:8]: gain for vdd reference, [6:0]: offset for vdd reference. 0x0fe081ba adc0_cal_5vdiff [14:8]: gain for 5vdiff reference, [6:0]: offset for 5vdiff reference. 0x0fe081bc adc0_cal_2xvdd [14:8]: reserved (gain for this reference cannot be calibrated), [6:0]: offset for 2xvdd reference. 0x0fe081be adc0_temp_0_read_1v25 [15:4] temperature reading at 1v25 reference, [3:0] reserved. 0x0fe081c8 dac0_cal_1v25 [22:16]: gain for 1v25 reference, [13:8]: channel 1 offset for 1v25 reference, [5:0]: channel 0 offset for 1v25 reference. 0x0fe081cc dac0_cal_2v5 [22:16]: gain for 2v5 reference, [13:8]: channel 1 offset for 2v5 reference, [5:0]: channel 0 offset for 2v5 reference. 0x0fe081d0 dac0_cal_vdd [22:16]: reserved (gain for this reference cannot be calibrated), [13:8]: channel 1 offset for vdd reference, [5:0]: channel 0 offset for vdd reference. 0x0fe081d4 auxhfrco_calib_band_1 [7:0]: tuning for the 1.2 mhz auxhfrco band. 0x0fe081d5 auxhfrco_calib_band_7 [7:0]: tuning for the 6.6 mhz auxhfrco band. 0x0fe081d6 auxhfrco_calib_band_11 [7:0]: tuning for the 11 mhz auxhfrco band. 0x0fe081d7 auxhfrco_calib_band_14 [7:0]: tuning for the 14 mhz auxhfrco band. 0x0fe081d8 auxhfrco_calib_band_21 [7:0]: tuning for the 21 mhz auxhfrco band. 0x0fe081d9 auxhfrco_calib_band_28 [7:0]: tuning for the 28 mhz auxhfrco band. 0x0fe081dc hfrco_calib_band_1 [7:0]: tuning for the 1.2 mhz hfrco band. 0x0fe081dd hfrco_calib_band_7 [7:0]: tuning for the 6.6 mhz hfrco band. 0x0fe081de hfrco_calib_band_11 [7:0]: tuning for the 11 mhz hfrco band. 0x0fe081df hfrco_calib_band_14 [7:0]: tuning for the 14 mhz hfrco band. 0x0fe081e0 hfrco_calib_band_21 [7:0]: tuning for the 21 mhz hfrco band. 0x0fe081e1 hfrco_calib_band_28 [7:0]: tuning for the 28 mhz hfrco band. 0x0fe081e7 mem_info_page_size [7:0] flash page size in bytes coded as 2 ^ ((mem_info_page_size + 10) & 0xff). ie. the value 0xff = 512 bytes. 0x0fe081f0 unique_0 [31:0] unique number. 0x0fe081f4 unique_1 [63:32] unique number. 0x0fe081f8 mem_info_flash [15:0]: flash size, kbyte count as unsigned integer (eg. 128). 0x0fe081fa mem_info_ram [15:0]: ram size, kbyte count as unsigned integer (eg. 16). 0x0fe081fc part_number [15:0]: efm32 part number as unsigned integer (eg. 230). 0x0fe081fe part_family [7:0]: efm32 part family number (gecko = 71, giant gecko = 72, tiny gecko = 73, leopard gecko=74, wonder gecko=75). 0x0fe081ff prod_rev [7:0]: efm32 production id.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 26 www.energymicro.com 6 dbg - debug interface 0 1 2 3 4 arm cor t e x-m 4 d bg d e b u g d a t a quick facts what? the dbg (debug interface) is used to program and debug EFM32WG devices. why? the debug interface makes it easy to re- program and update the system in the field, and allows debugging with minimal i/o pin usage. how? the cortex-m4 supports advanced debugging features. EFM32WG devices only use two port pins for debugging or programming. the internal and external state of the system can be examined with debug extensions supporting instruction or data access break- and watch points. 6.1 introduction the EFM32WG devices include hardware debug support through a 2-pin serial-wire debug interface and an embedded trace module (etm) for data/instruction tracing . in addition, there is also a serial wire viewer pin which can be used to output profiling information, data trace and software-generated messages. 6.2 features ? flash patch and breakpoint (fpb) unit ? implement breakpoints and code patches ? data watch point and trace (dwt) unit ? implement watch points, trigger resources and system profiling ? instrumentation trace macrocell (itm) ? application-driven trace source that supports printf style debugging ? embedded trace macrocell v3.5 (etm) ? real time instruction and data trace information of the processor 6.3 functional description there are three debug pins and four trace pins available on the device. operation of these pins are described in the following sections: 6.3.1 debug pins there are three debug pins on the device, which also can be used as gpio. the three debug pins are: ? serial wire clock input (swclk): this pin is enabled after reset and has a built-in pull down. ? serial wire data input/output (swdio): this pin is enabled after reset and has a built-in pull-up. ? serial wire viewer (swv): this pin is disabled after reset.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 27 www.energymicro.com for more information on how to enable the debug pin outputs/inputs the reader is referred to section 32.3.4.1 (p. 754 ) , the arm cortex-m4 technical reference manual and the arm coresight technical reference manual. note leaving the debug pins enabled will lead to an increase in current consumption in em2- em4. 6.3.2 embedded trace macrocell v3.5 (etm) the etm makes it possible to trace both instruction and data from the processor in real time. the trace can be controlled through a set of triggering and filtering resources. the resources include 4 address comparators, 2 data value comparators, 2 counters, a context id comparator and a sequencer. before enabling the etm, the auxhfrco clock needs to be enabled by setting auxhfrcoen in cmu_oscencmd. the trace can be exported through a set of trace pins, which include: ? trace clock (tclk): functions as a sample clock for the trace. this pin is disabled after reset. ? trace data 0 - trace data 3 (td0-td3): the data pins provide the compressed trace stream. these pins are disabled after reset. for information on how to configure the etm, see the arm cortex-m4 technical reference manual and the arm coresight technical reference manual. the trace clock and trace data pins can be enabled through the gpio. for more information on how to enable the etm trace pins, the reader is referred to section 32.3.4.2 (p. 754 ) . 6.4 debug lock and device erase the debug access to the cortex-m4 is locked by clearing the debug lock word (dlw), see section 7.3.2 (p. 33 ) . when debug access is locked, the debug interface remains accessible but the connection to the cortex- m4 core is blocked as shown in figure 6.2 (p. 28 ) . this mechanism is controlled by the authentication access port (aap) as illustrated by figure 6.1 (p. 27 ) . figure 6.1. aap - authentication access port sw-dp ahb-ap cor t e x serialwire debug int erface deviceerase aut hent icat ion access port ( aap) erasebusy alw[ 3:0] = = 0xf dlw[ 3:0] = = 0xf the device can be erased through the aap if the aap lock word (alw) has not been cleared, see see section 7.3.2 (p. 33 ) . this can be useful if the device has been programmed with code that, e.g., disables the debug interface pins on startup, or does something else that prevents communication with a debugger. obtaining debug access by unlocking the device must take place during the aap window. the aap window can also be extended giving the debugger more time to access the device by issuing the bit pattern on swdio/swclk as shown in figure 6.3 (p. 28 ) . after the aap window has closed, program execution will start provided that the device was successfully unlocked.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 28 www.energymicro.com figure 6.2. device unlock unlocked cort ex ext ended unlocked ext ended aap locked no access aap program execut ion reset 150 us 47 us no access aap cort ex 255 x 47 us no access program execut ion program execut ion figure 6.3. aap expansion swdio swclk aap expand the device is unlocked by writing to the aap_cmdkey register and then setting the deviceerase bit of the aap_cmd register via the debug interface. this erase operation erases the main block of flash, all lock bits are reset and debug access through the ahb-ap is enabled. the operation takes 125 ms to complete. note that the sram contents will also be deleted during a device erase. the debugger may read the status from the aap_status register. when the erasebusy bit is set low after deviceerase of the aap_cmd register is set, the debugger may set the sysresetreq bit in the aap_cmd register. after reset, the debugger may resume a normal debug session through the ahb-ap. note if the debug pins are reconfigured for other i/o purposes than debug, a device erase may no longer be executed. the pins are configured for debug in their reset state. 6.4.1 device erase during reset if the software disables the debug pins (making a device erase impossible), the erase command may also be issued while pin reset is asserted. a device erase will then be performed as soon as reset is deasserted.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 29 www.energymicro.com 6.5 register map the offset register address is relative to the registers base address. offset name type description 0x000 aap_cmd w1 command register 0x004 aap_cmdkey w1 command key register 0x008 aap_status r status register 0x0fc aap_idr r aap identification register 6.6 register description 6.6.1 aap_cmd - command register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name sysresetreq deviceerase bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 sysresetreq 0 w1 system reset request a system reset request is generated when set to 1. this register is write enabled from the aap_cmdkey register. 0 deviceerase 0 w1 erase the flash main block, sram and lock bits when set, all data and program code in the main block is erased, the sram is cleared and then the lock bit (lb) page is erased. this also includes the debug lock word (dlw), causing debug access to be enabled after the next reset. the information block user data page (ud) is left unchanged, but the user data page lock word (ulw) is erased. this register is write enabled from the aap_cmdkey register. 6.6.2 aap_cmdkey - command key register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access w1 name writekey bit name reset access description 31:0 writekey 0x00000000 w1 cmd key register
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 30 www.energymicro.com bit name reset access description the key value must be written to this register to write enable the aap_cmd register. value mode description 0xcfacc118 writeen enable write to aap_cmd 6.6.3 aap_status - status register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access r name erasebusy bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 erasebusy 0 r device erase command status this bit is set when a device erase is executing. 6.6.4 aap_idr - aap identification register offset bit position 0x0fc 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x16e60001 access r name id bit name reset access description 31:0 id 0x16e60001 r aap identification register access port identification register in compliance with the arm adi v5 specification (jedec manufacturer id) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 31 www.energymicro.com 7 msc - memory system controller 0 1 2 3 4 01000101011011100110010101110010 01100111011110010010000001001101 01101001011000110111001001101111 00100000011100100111010101101100 01100101011100110010000001110100 01101000011001010010000001110111 01101111011100100110110001100100 00100000011011110110011000100000 01101100011011110111011100101101 01100101011011100110010101110010 01100111011110010010000001101101 01101001011000110111001001101111 01100011011011110110111001110100 01110010011011110110110001101100 01100101011100100010000001100100 01100101011100110110100101100111 01101110001000010100010101101110 quick facts what? the user can perform flash memory read, read configuration and write operations through the memory system controller (msc) . why? the msc allows the application code, user data and flash lock bits to be stored in non- volatile flash memory. certain memory system functions, such as program memory wait-states and bus faults are also configured from the msc peripheral register interface, giving the developer the ability to dynamically customize the memory system performance, security level, energy consumption and error handling capabilities to the requirements at hand. how? the msc integrates a low-energy flash ip with a charge pump, enabling minimum energy consumption while eliminating the need for external programming voltage to erase the memory. an easy to use write and erase interface is supported by an internal, fixed-frequency oscillator and autonomous flash timing and control reduces software complexity while not using other timer resources. application code may dynamically scale between high energy optimization and high code execution performance through advanced read modes. a highly efficient low energy instruction cache reduces the number of flash reads significantly, thus saving energy. performance is also improved when wait- states are used, since many of the wait-states are eliminated. built-in performance counters can be used to measure the efficiency of the instruction cache. 7.1 introduction the memory system controller (msc) is the program memory unit of the EFM32WG microcontroller. the flash memory is readable and writable from both the cortex-m4 and dma. the flash memory is divided into two blocks; the main block and the information block. program code is normally written to the main block. additionally, the information block is available for special user data and flash lock bits. there is also a read-only page in the information block containing system and device calibration data. read and write operations are supported in the energy modes em0 and em1.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 32 www.energymicro.com 7.2 features ? ahb read interface ? scalable access performance to optimize the cortex-m4 code interface ? zero wait-state access up to 16 mhz and one wait-state for up to 32 mhz and two wait-states for up to 48 ? advanced energy optimization functionality ? conditional branch target prefetch suppression ? cortex-m4 disfolding of if-then (it) blocks ? instruction cache ? dma read support in em0 and em1 ? command and status interface ? flash write and erase ? accessible from cortex-m4 in em0 ? dma write support in em0 and em1 ? core clock independent flash timing ? internal oscillator and internal timers for precise and autonomous flash timing ? general purpose timers are not occupied during flash erase and write operations ? configurable interrupt erase abort ? improved interrupt predictability ? memory and bus fault control ? security features ? lockable debug access ? page lock bits ? sw mass erase lock bits ? authentication access port (aap) lock bits ? end-of-write and end-of-erase interrupts 7.3 functional description the size of the main block is device dependent. the largest size available is 256 kb (128 pages). the information block has 2048 bytes available for user data. the information block also contains chip configuration data located in a reserved area. the main block is mapped to address 0x00000000 and the information block is mapped to address 0x0fe00000. table 7.1 (p. 33 ) outlines how the flash is mapped in the memory space. all flash memory is organized into 2048 byte pages.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 33 www.energymicro.com table 7.1. msc flash memory mapping block page base address write/erase by software readable purpose/name size 0 0x00000000 software, debug yes . software, debug yes main 1 127 0x0003f800 software, debug yes user code and data 64 kb - 256 kb reserved - 0x00040000 - - reserved for flash expansion ~24 mb 0 0x0fe00000 software, debug yes user data (ud) 2 kb - 0x0fe00800 - - reserved - 1 0x0fe04000 write: software, debug erase: debug only yes lock bits (lb) 2 kb - 0x0fe04800 - - reserved - 2 0x0fe08000 - yes device information (di) 2 kb information - 0x0fe08800 - - reserved - reserved - 0x0fe10000 - - reserved for flash expansion rest of code space 1 block/page erased by a device erase 7.3.1 user data (ud) page description this is the user data page in the information block. the page can be erased and written by software. the page is erased by the erasepage command of the msc_writecmd register. note that the page is not erased by a device erase operation. the device erase operation is described in section 6.4 (p. 27 ) . 7.3.2 lock bits (lb) page description this page contains the following information: ? main block page lock words (plws) ? user data page lock word (ulws) ? debug lock word (dlw) ? mass erase lock word (mlw) the words in this page are organized as shown in table 7.2 (p. 33 ) : table 7.2. lock bits page structure 127 dlw 126 ulw 125 mlw n plw[n] ? ? 1 plw[1] 0 plw[0]
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 34 www.energymicro.com there are 32 page lock bits per page lock word (plw). bit 0 refers to the first page and bit 31 refers to the last page within a plw. thus, plw[0] contains lock bits for page 0-31 in the main block, plw[1] contains lock bits for page 32-63 etc. a page is locked when the bit is 0. a locked page cannot be erased or written. word 127 is the debug lock word (dlw). the four lsbs of this word are the debug lock bits. if these bits are 0xf, then debug access is enabled. debug access to the core is disabled from power-on reset until the dlw is evaluated immediately before the cortex-m4 starts execution of the user application code. if the bits are not 0xf, then debug access to the core remains blocked. word 126 is the user page lock word (ulw). bit 0 of this word is the user data page lock bit. bit 1 in this word locks the lock bits page. the lock bits can be reset by a device erase operation initiated from the authentication access port (aap) registers. the aap is described in more detail in section 6.4 (p. 27 ) . note that the aap is only accessible from the debug interface, and cannot be accessed from the cortex-m4 core. word 125 is the mass erase lock word (mlw). bit 0 locks the entire flash. the mass erase lock bits will not have any effect on device erases initiated from the authentication access port (aap) registers. the aap is described in more detail in section 6.4 (p. 27 ) . 7.3.3 device information (di) page this read-only page holds oscillator , dac and adc calibration data from the production test as well as an unique device id. the page is further described in section 5.6 (p. 24 ) . 7.3.4 device revision the device revision number is read from the rom table. the major revision number and the chip family number is read from pid0 and pid1 registers. the minor revision number is extracted from the pid2 and pid3 registers, as illustrated in figure 7.1 (p. 34 ) . the fam[5:2] and fam[1:0] must be combined to complete the chip family number, while the minor rev[7:4] and minor rev[3:0] must be combined to form the complete revision number. figure 7.1. revision number extraction pid1 ( 0 xe 0 0 fffe 4 ) 31:4 3:0 pid0 ( 0 xe 0 0 fffe 0 ) 31:7 6:5 5:0 major rev[ 5:0] pid3 ( 0 xe 0 0 fffec ) 31:8 7:4 3:0 minor rev[ 3:0] fam [ 1:0] fam [ 5:2] pid2 ( 0 xe 0 0 fffe 8 ) 31:8 7:4 3:0 minor rev[ 7:4] for the wonder gecko family, the chip family number is 0x3 and the major revision number is 0x1. the minor revision number is to be interpreted according to table 7.3 (p. 34 ) . table 7.3. revision number interpretation revision[7:0] revision 0x00 a 7.3.5 post-reset behavior calibration values are automatically written to registers by the msc before application code startup. the values are also available to read from the di page for later reference by software. other information such as the device id and production date is also stored in the di page and is readable from software.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 35 www.energymicro.com 7.3.5.1 one wait-state access after reset, the hfcoreclk is normally 14 mhz from the hfrco and the mode field of the msc_readctrl register is set to ws1 (one wait-state). the reset value must be ws1 as an uncalibrated hfrco may produce a frequency higher than 16 mhz. software must not select a zero wait-state mode unless the clock is guaranteed to be 16 mhz or below, otherwise the resulting behavior is undefined. if a hfcoreclk frequency above 16 mhz is to be set by software, the mode field of the msc_readctrl register must be set to ws1 or ws1scbtp before the core clock is switched to the higher frequency clock source. when changing to a lower frequency, the mode field of the msc_readctrl register must be set to ws0 or ws0scbtp only after the frequency transition has completed. if the hfrco is used, wait until the oscillator is stable on the new frequency. otherwise, the behavior is unpredictable. to run at a frequency higher than 32 mhz, ws2 or ws2scbtp must be selected to insert two wait- states for every flash access. 7.3.5.2 zero wait-state access at 16 mhz and below, read operations from flash may be performed without any wait-states. zero wait- state access greatly improves code execution performance at frequencies from 16 mhz and below. by default, the cortex-m4 uses speculative prefetching and if-then block folding to maximize code execution performance at the cost of additional flash accesses and energy consumption. 7.3.5.3 operation above 32 mhz to run at frequencies higher than 32 mhz, mode in msc_readctrl must be set to ws2 or ws2scbtp. 7.3.5.4 suppressed conditional branch target prefetch (scbtp) msc offers a special instruction fetch mode which optimizes energy consumption by cancelling cortex- m4 conditional branch target prefetches. normally, the cortex-m4 core prefetches both the next sequential instruction and the instruction at the branch target address when a conditional branch instruction reaches the pipeline decode stage. this prefetch scheme improves performance while one extra instruction is fetched from memory at each conditional branch, regardless of whether the branch is taken or not. to optimize for low energy, the msc can be configured to cancel these speculative branch target prefetches. with this configuration, energy consumption is more optimal, as the branch target instruction fetch is delayed until the branch condition is evaluated. the performance penalty with this mode enabled is source code dependent, but is normally less than 1% for core frequencies from 16 mhz and below. to enable the mode at frequencies from 16 mhz and below write ws0scbtp to the mode field of the msc_readctrl register. for frequencies above 16 mhz, use the ws1scbtp mode , and for frequencies above 32 mhz, use the ws2scbtp mode . an increased performance penalty per clock cycle must be expected compared to ws0scbtp mode. the performance penalty in ws1scbtp /ws2scbtp mode depends greatly on the density and organization of conditional branch instructions in the code. 7.3.5.5 cortex-m4 if-then block folding the cortex-m4 offers a mechanism known as if-then block folding. this is a form of speculative prefetching where small if-then blocks are collapsed in the prefetch buffer if the condition evaluates to false. the instructions in the block then appear to execute in zero cycles. with this scheme, performance is optimized at the cost of higher energy consumption as the processor fetches more instructions from memory than it actually executes. to disable the mode, write a 1 to the disfold bit in the nvic auxiliary control register; see the cortex-m4 technical reference manual for details. normally, it is expected that this feature is most efficient at core frequencies above 16 mhz. folding is enabled by default.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 36 www.energymicro.com 7.3.5.6 instruction cache the msc includes an instruction cache. the instruction cache for the internal flash memory is enabled by default, but can be disabled by setting ifcdis in msc_readctrl. when enabled, the instruction cache typically reduces the number of flash reads significantly, thus saving energy. in most cases a cache hit-rate of more than 70 % is achievable. when a 32-bit instruction fetch hits in the cache the data is returned to the processor in one clock cycle. thus, performance is also improved when wait-states are used (i.e. running at frequencies above 16 mhz). the instruction cache is connected directly to the icode bus on the cortex-m4 and functions as a memory access filter between the processor and the memory system, as illustrated in figure 7.2 (p. 36 ) . the cache consists of an access filter, lookup logic, a 128x32 sram (512 bytes) and two performance counters. the access filter checks that the address for the access is to on-chip flash memory (instructions in ram are not cached). if the address matches, the cache lookup logic and sram is enabled. otherwise, the cache is bypassed and the access is forwarded to the memory system. the cache is then updated when the memory access completes. the access filter also disables cache updates for interrupt context accesses if caching in interrupt context is disabled. the performance counters, when enabled, keep track of the number of cache hits and misses. the cache consists of 16 8-word cachelines organized as 4 sets with 4 ways. the cachelines are filled up continuously one word at a time as the individual words are requested by the processor. thus, not all words of a cacheline might be valid at a given time. figure 7.2. instruction cache cort ex 128x32 sram access filt er cache look -up logic icode ahb -lit e bus icode ahb -lit e bus code mem ory space inst ruct ion cache perform ance count ers idcode mux dcode ahb -lit e bus idcode ahb -lit e bus by default, the instruction cache is automatically invalidated when the contents of the flash is changed (i.e. written or erased). in many cases, however, the application only makes changes to data in the flash, not code. in this case, the automatic invalidate feature can be disabled by setting aidis in msc_readctrl. the cache can (independent of the aidis setting) be manually invalidated by writing 1 to invcache in msc_cmd. in general it is highly recommended to keep the cache enabled all the time. however, for some sections of code with very low cache hit-rate more energy-efficient execution can be achieved by disabling the cache temporarily. to measure the hit-rate of a code-section, the built-in performance counters can be used. before the section, start the performance counters by writing 1 to startpc in msc_cmd. this starts the performance counters, counting from 0. at the end of the section, stop the performance counters by writing 1 to stoppc in msc_cmd. the number of cache hits and cache misses for that section can then be read from msc_cachehits and msc_cachemisses respectively. the total number of 32-bit instruction fetches will be msc_cachehits + msc_cachemisses. thus, the cache hit-ratio can be calculated as msc_cachehits / (msc_cachehits + msc_cachemisses). when msc_cachehits overflows the chof interrupt flag is set. when msc_cachemisses overflows the cmof interrupt flag is set. these flags must be cleared explicitly by software. the range of the performance counters can thus be extended by increasing a counter in the msc interrupt routine. the performance counters only count when a cache lookup is performed. if the lookup fails, msc_cachemisses is increased. if the lookup is successful, msc_cachehits is increased. for example, a cache lookup is not performed if the cache is disabled or the code is executed from ram. when caching of vector fetches and instructions in interrupt routines is disabled (iccdis in msc_readctrl is set), the performance counters do not count when these types of fetches occur (i.e. while in interrupt context).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 37 www.energymicro.com by default, interrupt vector fetches and instructions in interrupt routines are also cached. some applications may get better cache utilization by not caching instructions in interrupt context. this is done by setting iccdis in msc_readctrl. you should only set this bit based on the results from a cache hit ratio measurement. in general, it is recommended to keep the iccdis bit cleared. note that lookups in the cache are still performed, regardless of the iccdis setting - but instructions are not cached when cache misses occur inside the interrupt routine. so, for example, if a cached function is called from the interrupt routine, the instructions for that function will be taken from the cache. the cache content is not retained in em2, em3 and em4. the cache is therefore invalidated regardless of the setting of aidis in msc_readctrl when entering these energy modes. applications that switch frequently between em0 and em2/3 and executes the very same non-looping code almost every time will most likely benefit from putting this code in ram. the interrupt vectors can also be put in ram to reduce current consumption even further. the cache also supports caching of instruction fetches from the external bus interface (ebi) when accessing the ebi through code space. by default, this is enabled, but it can be disabled by setting ebicdis in msc_readctrl. 7.3.6 erase and write operations the auxhfrco is used for timing during flash write and erase operations. to achieve correct timing, the msc_timebase register has to be configured according to the settings in cmu_auxhfrcoctrl. base in msc_timebase defines how many auxclk cycles - 1 there is in 1 us or 5 us, depending on the configuration of period. to ensure that timing of flash write and erase operations is within the specification of the flash, the value written to base should give at least a 10% margin with respect to the period, i.e. for the 1 us period, the number of cycles should at least span 1.1 us, and for the 5 us period they should span at least 5.5 us. for the 7mhz and 1mhz bands, it is recommended to set period in msc_timebase to 5us to achieve sufficient timing resolution. both page erase and write operations require that the address is written into the msc_addrb register. for erase operations, the address may be any within the page to be erased. load the address by writing 1 to the laddrim bit in the msc_writecmd register. the laddrim bit only has to be written once when loading the first address. after each word is written the internal address register addr will be incremented automatically by 4. the invaddr bit of the msc_status register is set if the loaded address is outside the flash and the locked bit of the msc_status register is set if the page addressed is locked. any attempts to command erase of or write to the page are ignored if invaddr or the locked bits of the msc_status register are set. to abort an ongoing erase, set the eraseabort bit in the msc_writecmd register. when a word is written to the msc_wdata register, the wdataready bit of the msc_status register is cleared. when this status bit is set, software or dma may write the next word. a single word write is commanded by setting the writeonce bit of the msc_writecmd register. the operation is complete when the busy bit of the msc_status register is cleared and control of the flash is handed back to the ahb interface, allowing application code to resume execution. for a dma write the software must write the first word to the msc_wdata register and then set the writetrig bit of the msc_writecmd register. dma triggers when the wdataready bit of the msc_status register is set. it is possible to write words twice between each erase by keeping at 1 the bits that are not to be changed. let us take as an example writing two 16 bit values, 0xaaaa and 0x5555. to safely write them in the same flash word this method can be used: ? write 0xffffaaaa (word in flash becomes 0xffffaaaa) ? write 0x5555ffff (word in flash becomes 0x5555aaaa) note
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 38 www.energymicro.com during a write or erase, flash read accesses will be stalled, effectively halting code execution from flash. code execution continues upon write/erase completion. code residing in ram may be executed during a write/erase operation. 7.3.6.1 mass erase a mass erase can be initiated from software using erasemain0 in msc_writecmd. this command will start a mass erase of the entire flash. prior to initiating a mass erase, msc_masslock must be unlocked by writing 0x631a to it. after a mass erase has been started, this register can be locked again to prevent runaway code from accidentally triggering a mass erase. the regular flash page lock bits will not prevent a mass erase. to prevent software from initiating mass erases, use the mass erase lock bits in the mass erase lock word (mlw).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 39 www.energymicro.com 7.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 msc_ctrl rw memory system control register 0x004 msc_readctrl rw read control register 0x008 msc_writectrl rw write control register 0x00c msc_writecmd w1 write command register 0x010 msc_addrb rw page erase/write address buffer 0x018 msc_wdata rw write data register 0x01c msc_status r status register 0x02c msc_if r interrupt flag register 0x030 msc_ifs w1 interrupt flag set register 0x034 msc_ifc w1 interrupt flag clear register 0x038 msc_ien rw interrupt enable register 0x03c msc_lock rw configuration lock register 0x040 msc_cmd w1 command register 0x044 msc_cachehits r cache hits performance counter 0x048 msc_cachemisses r cache misses performance counter 0x050 msc_timebase rw flash write and erase timebase 0x054 msc_masslock rw mass erase lock register 7.5 register description 7.5.1 msc_ctrl - memory system control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 access rw name busfault bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 busfault 1 rw bus fault response enable when this bit is set, the memory system generates bus error response. value mode description 0 generate a bus fault is generated on access to unmapped code and system space. 1 ignore accesses to unmapped address space is ignored.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 40 www.energymicro.com 7.5.2 msc_readctrl - read control register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 0 0x1 access rw rw rw rw rw rw rw name busstrategy ramcen ebicdis iccdis aidis ifcdis mode bit name reset access description 31:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 busstrategy 0x0 rw strategy for bus matrix specify which master has low latency to bus matrix. value mode description 0 cpu 1 dma 2 dmaem1 3 none 15:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 ramcen 0 rw ram cache enable enable instruction caching for ram in code-space. 6 ebicdis 0 rw external bus interface cache disable disable instruction cache for external bus interface. 5 iccdis 0 rw interrupt context cache disable set this bit to automatically disable caching of vector fetches and instruction fetches in interrupt context. cache lookup will still be performed in interrupt context. when set, the performance counters will not count when these types of fetches occur. 4 aidis 0 rw automatic invalidate disable when this bit is set the cache is not automatically invalidated when a write or page erase is performed. 3 ifcdis 0 rw internal flash cache disable disable instruction cache for internal flash memory. 2:0 mode 0x1 rw read mode after reset, the core clock is 14 mhz from the hfrco and the mode field of msc_readctrl register is set to ws1. the reset value is ws1 because the hfrco may produce a frequency above 16 mhz before it is calibrated. ws1 or ws1scbtp mode is required for a frequency above 16 mhz. if software wants to set a core clock frequency above 16 mhz, this register must be set to ws1 or ws1scbtp before the core clock is switched to the higher frequency. when changing to a lower frequency, this register can be set to ws0 or ws0scbtp after the frequency transition has been completed. if the hfrco is used as clock source, wait until the oscillator is stable on the new frequency to avoid unpredictable behavior. value mode description 0 ws0 zero wait-states inserted in fetch or read transfers. 1 ws1 one wait-state inserted for each fetch or read transfer. this mode is required for a core frequency above 16 mhz. 2 ws0scbtp zero wait-states inserted with the suppressed conditional branch target prefetch (scbtp) function enabled. scbtp saves energy by delaying the cortex' conditional branch target prefetches until the conditional branch instruction is in the execute stage. when the instruction reaches this stage, the evaluation of the branch condition is completed and the core does not perform a speculative prefetch of both the branch target address and the next sequential address. with the scbtp function enabled, one instruction fetch is saved for each branch not taken, with a negligible performance penalty. 3 ws1scbtp one wait-state access with scbtp enabled. 4 ws2 two wait-states inserted for each fetch or read transfer. this mode is required for a core frequency above 32 mhz. 5 ws2scbtp two wait-state access with scbtp enabled.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 41 www.energymicro.com 7.5.3 msc_writectrl - write control register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access rw rw name irqeraseabort wren bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 irqeraseabort 0 rw abort page erase on interrupt when this bit is set to 1, any cortex interrupt aborts any current page erase operation. executing that interrupt vector from flash will halt the cpu. 0 wren 0 rw enable write/erase controller when this bit is set, the msc write and erase functionality is enabled. 7.5.4 msc_writecmd - write command register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 name clearwdata erasemain0 eraseabort writetrig writeonce writeend erasepage laddrim bit name reset access description 31:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 clearwdata 0 w1 clear wdata state will set wdataready and dma request. should only be used when no write is active. 11:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 erasemain0 0 w1 mass erase region 0 initiate mass erase of region 0. for devices supporting read-while-write, this is the lower half of the flash. for other devices it is the entire flash. before use msc_masslock must be unlocked. to completely prevent access from software, clear bit 0 in the mass erase lock-word (mlw). 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 eraseabort 0 w1 abort erase sequence writing to this bit will abort an ongoing erase sequence. 4 writetrig 0 w1 word write sequence trigger start write of the first word written to msc_wdata, then add 4 to addr and write the next word if available within a 30us timeout. when addr is incremented past the page boundary, addr is set to the base of the page. if wdouble is set, two words are required every time, and addr is incremented by 8.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 42 www.energymicro.com bit name reset access description 3 writeonce 0 w1 word write-once trigger write the word in msc_wdata to addr. flash access is returned to the ahb interface as soon as the write operation completes. the wren bit in the msc_writectrl register must be set in order to use this command. 2 writeend 0 w1 end write mode write 1 to end write mode when using the writetrig command. 1 erasepage 0 w1 erase page erase any user defined page selected by the msc_addrb register. the wren bit in the msc_writectrl register must be set in order to use this command. 0 laddrim 0 w1 load msc_addrb into addr load the internal write address register addr from the msc_addrb register. the internal address register addr is incremented automatically by 4 after each word is written. when addr is incremented past the page boundary, addr is set to the base of the page. 7.5.5 msc_addrb - page erase/write address buffer offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name addrb bit name reset access description 31:0 addrb 0x00000000 rw page erase or write address buffer this register holds the page address for the erase or write operation. this register is loaded into the internal msc_addr register when the laddrim field in msc_writecmd is set. the msc_addr register is not readable. 7.5.6 msc_wdata - write data register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name wdata bit name reset access description 31:0 wdata 0x00000000 rw write data
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 43 www.energymicro.com bit name reset access description the data to be written to the address in msc_addr. this register must be written when the wdataready bit of msc_status is set, otherwise the data is ignored. 7.5.7 msc_status - status register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 1 0 0 0 access r r r r r r r name pcrunning eraseaborted wordtimeout wdataready invaddr locked busy bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 pcrunning 0 r performance counters running this bit is set while the performance counters are running. when one performance counter reaches the maximum value, this bit is cleared. 5 eraseaborted 0 r the current flash erase operation aborted when set, the current erase operation was aborted by interrupt. 4 wordtimeout 0 r flash write word timeout when this bit is set, msc_wdata was not written within the timeout. the flash write operation timed out and access to the flash is returned to the ahb interface. this bit is cleared when the erasepage, writetrig or writeonce commands in msc_writecmd are triggered. 3 wdataready 1 r wdata write ready when this bit is set, the content of msc_wdata is read by msc flash write controller and the register may be updated with the next 32-bit word to be written to flash. this bit is cleared when writing to msc_wdata. 2 invaddr 0 r invalid write address or erase page set when software attempts to load an invalid (unmapped) address into addr. 1 locked 0 r access locked when set, the last erase or write is aborted due to erase/write access constraints. 0 busy 0 r erase/write busy when set, an erase or write operation is in progress and new commands are ignored. 7.5.8 msc_if - interrupt flag register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access r r r r name cmof chof write erase bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 44 www.energymicro.com bit name reset access description 3 cmof 0 r cache misses overflow interrupt flag set when msc_cachemisses overflows. 2 chof 0 r cache hits overflow interrupt flag set when msc_cachehits overflows. 1 write 0 r write done interrupt read flag set when a write is done. 0 erase 0 r erase done interrupt read flag set when erase is done. 7.5.9 msc_ifs - interrupt flag set register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name cmof chof write erase bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 cmof 0 w1 cache misses overflow interrupt set set the cmof flag and generate interrupt. 2 chof 0 w1 cache hits overflow interrupt set set the chof flag and generate interrupt. 1 write 0 w1 write done interrupt set set the write done bit and generate interrupt. 0 erase 0 w1 erase done interrupt set set the erase done bit and generate interrupt. 7.5.10 msc_ifc - interrupt flag clear register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name cmof chof write erase bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 cmof 0 w1 cache misses overflow interrupt clear
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 45 www.energymicro.com bit name reset access description clear the cmof interrupt flag. 2 chof 0 w1 cache hits overflow interrupt clear clear the chof interrupt flag. 1 write 0 w1 write done interrupt clear clear the write done bit. 0 erase 0 w1 erase done interrupt clear clear the erase done bit. 7.5.11 msc_ien - interrupt enable register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access rw rw rw rw name cmof chof write erase bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 cmof 0 rw cache misses overflow interrupt enable enable the cache misses performance counter overflow interrupt. 2 chof 0 rw cache hits overflow interrupt enable enable the cache hits performance counter overflow interrupt. 1 write 0 rw write done interrupt enable enable the write done interrupt. 0 erase 0 rw erase done interrupt enable enable the erase done interrupt. 7.5.12 msc_lock - configuration lock register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name lockkey bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 46 www.energymicro.com bit name reset access description 15:0 lockkey 0x0000 rw configuration lock write any other value than the unlock code to lock access to msc_ctrl, msc_readctrl, msc_writectrl and msc_timebase. write the unlock code to enable access. when reading the register, bit 0 is set when the lock is enabled. mode value description read operation unlocked 0 msc registers are unlocked. locked 1 msc registers are locked. write operation lock 0 lock msc registers. unlock 0x1b71 unlock msc registers. 7.5.13 msc_cmd - command register offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access w1 w1 w1 name stoppc startpc invcache bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 stoppc 0 w1 stop performance counters use this command bit to stop the performance counters. 1 startpc 0 w1 start performance counters use this command bit to start the performance counters. the performance counters always start counting from 0. 0 invcache 0 w1 invalidate instruction cache use this register to invalidate the instruction cache. 7.5.14 msc_cachehits - cache hits performance counter offset bit position 0x044 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000 access r name cachehits bit name reset access description 31:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 47 www.energymicro.com bit name reset access description 19:0 cachehits 0x00000 r cache hits since last performance counter start command. use to measure cache performance for a particular code section. 7.5.15 msc_cachemisses - cache misses performance counter offset bit position 0x048 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000 access r name cachemisses bit name reset access description 31:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19:0 cachemisses 0x00000 r cache misses since last performance counter start command. use to measure cache performance for a particular code section. 7.5.16 msc_timebase - flash write and erase timebase offset bit position 0x050 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x10 access rw rw name period base bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 period 0 rw sets the timebase period decides whether timebase specifies the number of aux cycles in 1 us or 5 us. value mode description 0 1us timebase period is 1 us. 1 5us timebase period is 5 us. 15:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:0 base 0x10 rw timebase used by msc to time flash writes and erases should be set to the number of aux clock cycles-1 in 1.1 us if tbperiod is cleared, or the number of aux clock cycles-1 in 5.5 us if tbperiod is set. the value should be rounded up to make sure the number of clock cycles generate at least the specified time. the resetvalue of the timebase matches a 14 mhz auxhfrco, which is the default frequency of the auxhfrco.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 48 www.energymicro.com 7.5.17 msc_masslock - mass erase lock register offset bit position 0x054 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0001 access rw name lockkey bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 lockkey 0x0001 rw mass erase lock write any other value than the unlock code to lock access the the erasemain0 and erasemain1 commands. write the unlock code 631a to enable access. when reading the register, bit 0 is set when the lock is enabled. locked by default. mode value description read operation unlocked 0 mass erase unlocked. locked 1 mass erase locked. write operation lock 0 lock mass erase. unlock 0x631a unlock mass erase.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 49 www.energymicro.com 8 dma - dma controller 0 1 2 3 4 dma cont roller flash ram ext ernal bus int erface peripherals quick facts what? the dma controller can move data without cpu intervention, effectively reducing the energy consumption for a data transfer. why? the dma can perform data transfers more energy efficiently than the cpu and allows autonomous operation in low energy modes. the leuart can for instance provide full uart communication in em2, consuming only a few a by using the dma to move data between the leuart and ram. how? the dma controller has multiple highly configurable, prioritized dma channels. advanced transfer modes such as ping-pong and scatter-gather make it possible to tailor the controller to the specific needs of an application. 8.1 introduction the direct memory access (dma) controller performs memory operations independently of the cpu. this has the benefit of reducing the energy consumption and the workload of the cpu, and enables the system to stay in low energy modes for example when moving data from the usart to ram or from the external bus interface (ebi) to the dac. the dma controller uses the pl230 dma controller licensed from arm 1 . each of the pl230s channels on the efm32 can be connected to any of the efm32 peripherals. 8.2 features ? the dma controller is accessible as a memory mapped peripheral ? possible data transfers include ? ram /ebi /flash to peripheral ? ram /ebi to flash ? peripheral to ram /ebi ? ram /ebi /flash to ram /ebi ? the dma controller has 12 independent channels ? each channel has one (primary) or two (primary and alternate) descriptors ? the configuration for each channel includes ? transfer mode ? priority ? word-count ? word-size (8, 16, 32 bit) ? the transfer modes include ? basic (using the primary or alternate dma descriptor) 1 arm pl230 homepage [ http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0417a/index.html ]
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 50 www.energymicro.com ? ping-pong (switching between the primary or alternate dma descriptors, for continuous data flow to/from peripherals) ? scatter-gather (using the primary descriptor to configure the alternate descriptor) ? each channel has a programmable transfer length ? channels 0 and 1 support looped transfers ? channel 0 supports 2d copy ? a dma channel can be triggered by any of several sources: ? communication modules (usart, uart, leuart) ? timers (timer) ? analog modules ( dac, acmp, adc) ? external bus interface (ebi) ? software ? programmable mapping between channel number and peripherals - any dma channel can be triggered by any of the available sources ? interrupts upon transfer completion ? data transfer to/from leuart in em2 is supported by the dma, providing extremely low energy consumption while performing uart communications 8.3 block diagram an overview of the dma and the modules it interacts with is shown in figure 8.1 (p. 50 ) . figure 8.1. dma block diagram int errupt s apb block apb m em ory m apped regist ers ahb block ahb-lit e m ast er int erface dma cont rol block dma core cort ex ahb t o apb bridge ahb configurat ion cont rol dma dat a t ransfer error channel done peripheral peripheral channel select req/ ack configurat ion the dma controller consists of four main parts: ? an apb block allowing software to configure the dma controller ? an ahb block allowing the dma to read and write the dma descriptors and the source and destination data for the dma transfers ? a dma control block controlling the operation of the dma, including request/acknowledge signals for the connected peripherals
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 51 www.energymicro.com ? a channel select block routing the right peripheral request to each dma channel 8.4 functional description the dma controller is highly flexible. it is capable of transferring data between peripherals and memory without involvement from the processor core. this can be used to increase system performance by off-loading the processor from copying large amounts of data or avoiding frequent interrupts to service peripherals needing more data or having available data. it can also be used to reduce the system energy consumption by making the dma work autonomously with the leuart for data transfer in em2 without having to wake up the processor core from sleep. the dma controller contains 12 independent channels. each of these channels can be connected to any of the available peripheral trigger sources by writing to the configuration registers, see section 8.4.1 (p. 51 ) . in addition, each channel can be triggered by software (for large memory transfers or for debugging purposes). what the dma controller should do (when one of its channels is triggered) is configured through channel descriptors residing in system memory. before enabling a channel, the software must therefore take care to write this configuration to memory. when a channel is triggered, the dma controller will first read the channel descriptor from system memory, and then it will proceed to perform the memory transfers as specified by the descriptor. the descriptor contains the memory address to read from, the memory address to write to, the number of bytes to be transferred, etc. the channel descriptor is described in detail in section 8.4.3 (p. 62 ) . in addition to the basic transfer mode, the dma controller also supports two advanced transfer modes; ping-pong and scatter-gather. ping-pong transfers are ideally suited for streaming data for high-speed peripheral communication as the dma will be ready to retrieve the next incoming data bytes immediately while the processor core is still processing the previous ones (and similarly for outgoing communication). scatter-gather involves executing a series of tasks from memory and allows sophisticated schemes to be implemented by software. using different priority levels for the channels and setting the number of bytes after which the dma controller re-arbitrates, it is possible to ensure that timing-critical transfers are serviced on time. 8.4.1 channel select configuration the channel select block allows selecting which peripheral's request lines (dma_req, dma_sreq) to connect to each dma channel. this configuration is done by software through the control registers dma_ch0_ctrl- dma_ch11_ctrl, with sourcesel and sigsel components. sourcesel selects which peripheral to listen to and sigsel picks which output signals to use from the selected peripheral. all peripherals are connected to dma_req. when this signal is triggered, the dma performs a number of transfers as specified by the channel descriptor (2 r ). the usarts are additionally connected to the dma_sreq line. when only dma_sreq is asserted but not dma_req, then the dma will perform exactly one transfer only (given that dma_sreq is enabled by software). 8.4.2 dma control 8.4.2.1 dma arbitration rate you can configure when the controller arbitrates during a dma transfer. this enables you to reduce the latency to service a higher priority channel. the controller provides four bits that configure how many ahb bus transfers occur before it re-arbitrates. these bits are known as the r_power bits because the value you enter, r, is raised to the power of two
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 52 www.energymicro.com and this determines the arbitration rate. for example, if r = 4 then the arbitration rate is 2 4 , that is, the controller arbitrates every 16 dma transfers. table 8.1 (p. 52 ) lists the arbitration rates. table 8.1. ahb bus transfer arbitration interval r_power arbitrate after x dma transfers b0000 x = 1 b0001 x = 2 b0010 x = 4 b0011 x = 8 b0100 x = 16 b0101 x = 32 b0110 x = 64 b0111 x = 128 b1000 x = 256 b1001 x = 512 b1010 - b1111 x = 1024 note you must take care not to assign a low-priority channel with a large r_power because this prevents the controller from servicing high-priority requests, until it re-arbitrates. the number of dma transfers n that need to be done is specified by the user. when n > 2 r and is not an integer multiple of 2 r then the controller always performs sequences of 2 r transfers until n < 2 r remain to be transferred. the controller performs the remaining n transfers at the end of the dma cycle. you store the value of the r_power bits in the channel control data structure. see section 8.4.3.3 (p. 65 ) for more information about the location of the r_power bits in the data structure. 8.4.2.2 priority when the controller arbitrates, it determines the next channel to service by using the following information: ? the channel number ? the priority level, default or high, that is assigned to the channel. you can configure each channel to use either the default priority level or a high priority level by setting the dma_chpris register. channel number zero has the highest priority and as the channel number increases, the priority of a channel decreases. table 8.2 (p. 52 ) lists the dma channel priority levels in descending order of priority. table 8.2. dma channel priority channel number priority level setting descending order of channel priority 0 high highest-priority dma channel
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 53 www.energymicro.com channel number priority level setting descending order of channel priority 1 high - 2 high - 3 high - 4 high - 5 high - 6 high - 7 high - 8 high - 9 high - 10 high - 11 high - 0 default - 1 default - 2 default - 3 default - 4 default - 5 default - 6 default - 7 default - 8 default - 9 default - 10 default - 11 default lowest-priority dma channel after a dma transfer completes, the controller polls all the dma channels that are available. figure 8.2 (p. 54 ) shows the process it uses to determine which dma transfer to perform next.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 54 www.energymicro.com figure 8.2. polling flowchart st art polling is t here a channel request ? are any channel request s using a high priorit y - level ? st art dma t ransfer yes yes select channel t hat has t he lowest channel num ber and is set t o high priorit y -level select channel t hat has t he lowest channel num ber no no 8.4.2.3 dma cycle types the cycle_ctrl bits control how the controller performs a dma cycle. you can set the cycle_ctrl bits as table 8.3 (p. 54 ) lists. table 8.3. dma cycle types cycle_ctrl description b000 channel control data structure is invalid b001 basic dma transfer b010 auto-request b011 ping-pong b100 memory scatter-gather using the primary data structure b101 memory scatter-gather using the alternate data structure b110 peripheral scatter-gather using the primary data structure b111 peripheral scatter-gather using the alternate data structure note the cycle_ctrl bits are located in the channel_cfg memory location that section 8.4.3.3 (p. 65 ) describes. for all cycle types, the controller arbitrates after 2 r dma transfers. if you set a low-priority channel with a large 2 r value then it prevents all other channels from performing a dma transfer, until the low-priority
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 55 www.energymicro.com dma transfer completes. therefore, you must take care when setting the r_power, that you do not significantly increase the latency for high-priority channels. 8.4.2.3.1 invalid after the controller completes a dma cycle it sets the cycle type to invalid, to prevent it from repeating the same dma cycle. 8.4.2.3.2 basic in this mode, you configure the controller to use either the primary or the alternate data structure. after you enable the channel c and the controller receives a request for this channel, then the flow for this dma cycle is as follows: 1. the controller performs 2 r transfers. if the number of transfers remaining becomes zero, then the flow continues at step 3 (p. 55 ) . 2. the controller arbitrates: ? if a higher-priority channel is requesting service then the controller services that channel ? if the peripheral or software signals a request to the controller then it continues at step 1 (p. 55 ) . 3. the controller sets dma_done[c] high for one hfcoreclk cycle. this indicates to the host processor that the dma cycle is complete. 8.4.2.3.3 auto-request when the controller operates in this mode, it is only necessary for it to receive a single request to enable it to complete the entire dma cycle. this enables a large data transfer to occur, without significantly increasing the latency for servicing higher priority requests, or requiring multiple requests from the processor or peripheral. you can configure the controller to use either the primary or the alternate data structure. after you enable the channel c and the controller receives a request for this channel, then the flow for this dma cycle is as follows: 1. the controller performs 2 r transfers for channel c. if the number of transfers remaining is zero the flow continues at step 3 (p. 55 ) . 2. the controller arbitrates. when channel c has the highest priority then the dma cycle continues at step 1 (p. 55 ) . 3. the controller sets dma_done[c] high for one hfcoreclk cycle. this indicates to the host processor that the dma cycle is complete. 8.4.2.3.4 ping-pong in ping-pong mode, the controller performs a dma cycle using one of the data structures (primary or alternate) and it then performs a dma cycle using the other data structure. the controller continues to switch from primary to alternate to primary? until it reads a data structure that is invalid, or until the host processor disables the channel. figure 8.3 (p. 56 ) shows an example of a ping-pong dma transaction.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 56 www.energymicro.com figure 8.3. ping-pong example task a request request task a: prim ary, cycle_ct rl = b011, 2 r = 4, n = 6 d m a _d on e [ c] task b request request task b: alt ernat e, cycle_ct rl = b011, 2 r = 4, n = 12 d m a _d on e [ c] request task c request task c: prim ary, cycle_ct rl = b011, 2 r = 2, n = 2 d m a _d on e [ c] task d request request task d: alt ernat e, cycle_ct rl = b011, 2 r = 4, n = 5 d m a _d on e [ c] task e request task e: prim ary, cycle_ct rl = b011, 2 r = 4, n = 7 d m a _d on e [ c] end: alt ernat e, cycle_ct rl = b000 invalid request in figure 8.3 (p. 56 ) : task a 1. the host processor configures the primary data structure for task a. 2. the host processor configures the alternate data structure for task b. this enables the controller to immediately switch to task b after task a completes, provided that a higher priority channel does not require servicing. 3. the controller receives a request and performs four dma transfers. 4. the controller arbitrates. after the controller receives a request for this channel, the flow continues if the channel has the highest priority. 5. the controller performs the remaining two dma transfers. 6. the controller sets dma_done[c] high for one hfcoreclk cycle and enters the arbitration process. after task a completes, the host processor can configure the primary data structure for task c. this enables the controller to immediately switch to task c after task b completes, provided that a higher priority channel does not require servicing. after the controller receives a new request for the channel and it has the highest priority then task b commences: task b 7. the controller performs four dma transfers. 8. the controller arbitrates. after the controller receives a request for this channel, the flow continues if the channel has the highest priority.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 57 www.energymicro.com 9. the controller performs four dma transfers. 10. the controller arbitrates. after the controller receives a request for this channel, the flow continues if the channel has the highest priority. 11. the controller performs the remaining four dma transfers. 12. the controller sets dma_done[c] high for one hfcoreclk cycle and enters the arbitration process. after task b completes, the host processor can configure the alternate data structure for task d. after the controller receives a new request for the channel and it has the highest priority then task c commences: task c 13. the controller performs two dma transfers. 14. the controller sets dma_done[c] high for one hfcoreclk cycle and enters the arbitration process. after task c completes, the host processor can configure the primary data structure for task e. after the controller receives a new request for the channel and it has the highest priority then task d commences: task d 15. the controller performs four dma transfers. 16. the controller arbitrates. after the controller receives a request for this channel, the flow continues if the channel has the highest priority. 17. the controller performs the remaining dma transfer. 18. the controller sets dma_done[c] high for one hfcoreclk cycle and enters the arbitration process. after the controller receives a new request for the channel and it has the highest priority then task e commences: task e 19. the controller performs four dma transfers. 20. the controller arbitrates. after the controller receives a request for this channel, the flow continues if the channel has the highest priority. 21. the controller performs the remaining three dma transfers. 22. the controller sets dma_done[c] high for one hfcoreclk cycle and enters the arbitration process. if the controller receives a new request for the channel and it has the highest priority then it attempts to start the next task. however, because the host processor has not configured the alternate data structure, and on completion of task d the controller set the cycle_ctrl bits to b000, then the ping-pong dma transaction completes. note you can also terminate the ping-pong dma cycle in figure 8.3 (p. 56 ) , if you configure task e to be a basic dma cycle by setting the cycle_ctrl field to 3?b001. 8.4.2.3.5 memory scatter-gather in memory scatter-gather mode the controller receives an initial request and then performs four dma transfers using the primary data structure. after this transfer completes, it starts a dma cycle using the alternate data structure. after this cycle completes, the controller performs another four dma transfers
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 58 www.energymicro.com using the primary data structure. the controller continues to switch from primary to alternate to primary? until either: ? the host processor configures the alternate data structure for a basic cycle ? it reads an invalid data structure. note after the controller completes the n primary transfers it invalidates the primary data structure by setting the cycle_ctrl field to b000. the controller only asserts dma_done[c] when the scatter-gather transaction completes using an auto- request cycle. in scatter-gather mode, the controller uses the primary data structure to program the alternate data structure. table 8.4 (p. 58 ) lists the fields of the channel_cfg memory location for the primary data structure, that you must program with constant values and those that can be user defined. table 8.4. channel_cfg for a primary data structure, in memory scatter-gather mode bit field value description constant-value fields: [31:30} dst_inc b10 configures the controller to use word increments for the address [29:28] dst_size b10 configures the controller to use word transfers [27:26] src_inc b10 configures the controller to use word increments for the address [25:24] src_size b10 configures the controller to use word transfers [17:14] r_power b0010 configures the controller to perform four dma transfers [3] next_useburst 0 for a memory scatter-gather dma cycle, this bit must be set to zero [2:0] cycle_ctrl b100 configures the controller to perform a memory scatter-gather dma cycle user defined values: [23:21] dst_prot_ctrl - configures the state of hprot when the controller writes the destination data [20:18] src_prot_ctrl - configures the state of hprot when the controller reads the source data [13:4] n_minus_1 n 1 configures the controller to perform n dma transfers, where n is a multiple of four 1 because the r_power field is set to four, you must set n to be a multiple of four. the value given by n/4 is the number of times that you must configure the alternate data structure. see section 8.4.3.3 (p. 65 ) for more information. figure 8.4 (p. 59 ) shows a memory scatter-gather example.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 59 www.energymicro.com figure 8.4. memory scatter-gather example copy from a in m em ory , t o alt ernat e request 1. configure prim ary t o enable t he copy a, b, c, and d operat ions: cycle_ct rl = b100, 2 r = 4, n = 16. task a task b aut o request d m a _d on e [ c] copy from b in m em ory , t o alt ernat e aut o request aut o request aut o request aut o request aut o request copy from c in m em ory , t o alt ernat e task c copy from d in m em ory , t o alt ernat e task d dat a for task a cycle_ct rl = b101, 2 r = 4, n = 3 cycle_ct rl = b101, 2 r = 2, n = 8 cycle_ct rl = b101, 2 r = 8, n = 5 cycle_ct rl = b01 0 , 2 r = 4, n = 4 src_dat a_end_pt r dst _dat a_end_pt r channel_cfg unused 0x0a000000 0x0ae00000 0x0b000000 0x0be00000 0x0c000000 0x0ce00000 0x0d000000 0x0de00000 0xxxxxxxxx 0xxxxxxxxx 0xxxxxxxxx dat a for task b dat a for task c dat a for task d mem ory scat t er-gat her t ransact ion: init ializat ion: aut o request aut o request aut o request aut o request pr im a r y alt e r n a t e n = 3, 2 r = 4 n = 8, 2 r = 2 n = 5, 2 r = 8 n = 4, 2 r = 4 2. writ e t he prim ary source dat a t o m em ory, using t he st ruct ure shown in t he following t able. 0xxxxxxxxx in figure 8.4 (p. 59 ) : initialization 1. the host processor configures the primary data structure to operate in memory scatter-gather mode by setting cycle_ctrl to b100. because a data structure for a single channel consists of four words then you must set 2 r to 4. in this example, there are four tasks and therefore n is set to 16. 2. the host processor writes the data structure for tasks a, b, c, and d to the memory locations that the primary src_data_end_ptr specifies. 3. the host processor enables the channel. the memory scatter-gather transaction commences when the controller receives a request on dma_req[ ] or a manual request from the host processor. the transaction continues as follows: primary, copy a 1. after receiving a request, the controller performs four dma transfers. these transfers write the alternate data structure for task a. 2. the controller generates an auto-request for the channel and then arbitrates. task a 3. the controller performs task a. after it completes the task, it generates an auto-request for the channel and then arbitrates. primary, copy b 4. the controller performs four dma transfers. these transfers write the alternate data structure for task b. 5. the controller generates an auto-request for the channel and then arbitrates. task b 6. the controller performs task b. after it completes the task, it generates an auto-request for the channel and then arbitrates. primary, copy c 7. the controller performs four dma transfers. these transfers write the alternate data structure for task c.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 60 www.energymicro.com 8. the controller generates an auto-request for the channel and then arbitrates. task c 9. the controller performs task c. after it completes the task, it generates an auto-request for the channel and then arbitrates. primary, copy d 10. the controller performs four dma transfers. these transfers write the alternate data structure for task d. 11. the controller sets the cycle_ctrl bits of the primary data structure to b000, to indicate that this data structure is now invalid. 12. the controller generates an auto-request for the channel and then arbitrates. task d 13. the controller performs task d using an auto-request cycle. 14. the controller sets dma_done[c] high for one hfcoreclk cycle and enters the arbitration process. 8.4.2.3.6 peripheral scatter-gather in peripheral scatter-gather mode the controller receives an initial request from a peripheral and then it performs four dma transfers using the primary data structure. it then immediately starts a dma cycle using the alternate data structure, without re-arbitrating. note these are the only circumstances, where the controller does not enter the arbitration process after completing a transfer using the primary data structure. after this cycle completes, the controller re-arbitrates and if the controller receives a request from the peripheral that has the highest priority then it performs another four dma transfers using the primary data structure. it then immediately starts a dma cycle using the alternate data structure, without re- arbitrating. the controller continues to switch from primary to alternate to primary? until either: ? the host processor configures the alternate data structure for a basic cycle ? it reads an invalid data structure. note after the controller completes the n primary transfers it invalidates the primary data structure by setting the cycle_ctrl field to b000. the controller asserts dma_done[c] when the scatter-gather transaction completes using a basic cycle. in scatter-gather mode, the controller uses the primary data structure to program the alternate data structure. table 8.5 (p. 60 ) lists the fields of the channel_cfg memory location for the primary data structure, that you must program with constant values and those that can be user defined. table 8.5. channel_cfg for a primary data structure, in peripheral scatter-gather mode bit field value description constant-value fields: [31:30] dst_inc b10 configures the controller to use word increments for the address [29:28] dst_size b10 configures the controller to use word transfers [27:26] src_inc b10 configures the controller to use word increments for the address [25:24] src_size b10 configures the controller to use word transfers [17:14] r_power b0010 configures the controller to perform four dma transfers [2:0] cycle_ctrl b110 configures the controller to perform a peripheral scatter-gather dma cycle user defined values: [23:21] dst_prot_ctrl - configures the state of hprot when the controller writes the destination data [20:18] src_prot_ctrl - configures the state of hprot when the controller reads the source data
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 61 www.energymicro.com bit field value description [13:4] n_minus_1 n 1 configures the controller to perform n dma transfers, where n is a multiple of four [3] next_useburst - when set to 1, the controller sets the chnl_useburst_set [c] bit to 1 after the alternate transfer completes 1 because the r_power field is set to four, you must set n to be a multiple of four. the value given by n/4 is the number of times that you must configure the alternate data structure. see section 8.4.3.3 (p. 65 ) for more information. figure 8.5 (p. 61 ) shows a peripheral scatter-gather example. figure 8.5. peripheral scatter-gather example copy from a in m em ory , t o alt ernat e request task a task b request copy from b in m em ory , t o alt ernat e request request copy from c in m em ory , t o alt ernat e task c copy from d in m em ory , t o alt ernat e task d peripheral scat t er-gat her t ransact ion: for all prim ary t o alt ernat e t ransit ions, t he cont roller does not ent er t he arbit rat ion process and im m ediat ely perform s t he dma t ransfer t hat t he alt ernat e channel cont rol dat a st ruct ure specifies . 1. configure prim ary t o enable t he copy a, b, c, and d operat ions: cycle_ct rl = b110, 2 r = 4, n = 16. init ializat ion: 2. writ e t he prim ary source dat a in m em ory, using t he st ruct ure shown in t he following t able. cycle_ct rl = b111, 2 r = 4, n = 3 cycle_ct rl = b111, 2 r = 2, n = 8 cycle_ct rl = b111, 2 r = 8, n = 5 cycle_ct rl = b001, 2 r = 4, n = 4 src_dat a_end_pt r dst _dat a_end_pt r channel_cfg unused 0x0a000000 0x0ae00000 0x0b000000 0x0be00000 0x0c000000 0x0ce00000 0x0d000000 0x0de00000 0xxxxxxxxx 0xxxxxxxxx 0xxxxxxxxx 0xxxxxxxxx dat a for task a dat a for task b dat a for task c dat a for task d request request request pr im a r y alt e r n a t e d m a _d on e [ c] n = 3, 2 r = 4 n = 8, 2 r = 2 n = 5, 2 r = 8 n = 4, 2 r = 4 in figure 8.5 (p. 61 ) : initialization 1. the host processor configures the primary data structure to operate in peripheral scatter-gather mode by setting cycle_ctrl to b110. because a data structure for a single channel consists of four words then you must set 2 r to 4. in this example, there are four tasks and therefore n is set to 16. 2. the host processor writes the data structure for tasks a, b, c, and d to the memory locations that the primary src_data_end_ptr specifies. 3. the host processor enables the channel. the peripheral scatter-gather transaction commences when the controller receives a request on dma_req[ ] . the transaction continues as follows:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 62 www.energymicro.com primary, copy a 1. after receiving a request, the controller performs four dma transfers. these transfers write the alternate data structure for task a. task a 2. the controller performs task a. 3. after the controller completes the task it enters the arbitration process. after the peripheral issues a new request and it has the highest priority then the process continues with: primary, copy b 4. the controller performs four dma transfers. these transfers write the alternate data structure for task b. task b 5. the controller performs task b. to enable the controller to complete the task, the peripheral must issue a further three requests. 6. after the controller completes the task it enters the arbitration process. after the peripheral issues a new request and it has the highest priority then the process continues with: primary, copy c 7. the controller performs four dma transfers. these transfers write the alternate data structure for task c. task c 8. the controller performs task c. 9. after the controller completes the task it enters the arbitration process. after the peripheral issues a new request and it has the highest priority then the process continues with: primary, copy d 10. the controller performs four dma transfers. these transfers write the alternate data structure for task d. 11. the controller sets the cycle_ctrl bits of the primary data structure to b000, to indicate that this data structure is now invalid. task d 12. the controller performs task d using a basic cycle. 13. the controller sets dma_done[c] high for one hfcoreclk cycle and enters the arbitration process. 8.4.2.4 error signaling if the controller detects an error response on the ahb-lite master interface, it: ? disables the channel that corresponds to the error ? sets dma_err high. after the host processor detects that dma_err is high, it must check which channel was active when the error occurred. it can do this by: 1. reading the dma_chens register to create a list of disabled channels. when a channel asserts dma_done[ ] then the controller disables the channel. the program running on the host processor must always keep a record of which channels have recently asserted their dma_done[ ] outputs. 2. it must compare the disabled channels list from step 1 (p. 62 ) , with the record of the channels that have recently set their dma_done[ ] outputs. the channel with no record of dma_done[c] being set is the channel that the error occurred on. 8.4.3 channel control data structure you must provide an area of system memory to contain the channel control data structure. this system memory must:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 63 www.energymicro.com ? provide a contiguous area of system memory that the controller and host processor can access ? have a base address that is an integer multiple of the total size of the channel control data structure. figure 8.6 (p. 63 ) shows the memory that the controller requires for the channel control data structure, when all 12 channels and the optional alternate data structure are in use. figure 8.6. memory map for 12 channels, including the alternate data structure prim ary_ch_0 prim ary_ch_1 prim ary_ch_2 prim ary_ch_3 prim ary_ch_4 prim ary_ch_5 prim ary_ch_6 prim ary_ch_7 0x000 0x010 0x050 0x080 0x070 0x060 0x040 0x030 0x020 alt ernat e_ch_0 alt ernat e_ch_1 alt ernat e_ch_2 alt ernat e_ch_3 alt ernat e_ch_4 alt ernat e_ch_5 alt ernat e_ch_6 alt ernat e_ch_7 0x 100 0x 110 0x 150 0x 180 0x 170 0x 160 0x 140 0x 130 0x 120 dest inat ion end point er source end point er cont rol user 0x000 0x004 0x008 0x00c alt ernat e dat a st ruct ure prim ary dat a st ruct ure prim ary_ch_ 8 prim ary_ch_ 9 prim ary_ch_ 10 prim ary_ch_ 11 0x0 9 0 0x0 c 0 0x0 b 0 0x0 a 0 alt ernat e_ch_ 8 alt ernat e_ch_ 9 alt ernat e_ch_ 10 alt ernat e_ch_ 11 0x 190 0x 1 c 0 0x 1 b 0 0x 1 a 0 this structure in figure 8.6 (p. 63 ) uses 384 bytes of system memory. the controller uses the lower 8 address bits to enable it to access all of the elements in the structure and therefore the base address must be at 0xxxxxxx00 . you can configure the base address for the primary data structure by writing the appropriate value in the dma_ctrlbase register. you do not need to set aside the full 384 bytes if all dma channels are not used or if all alternate descriptors are not used. if, for example, only 4 channels are used and they only need the primary descriptors, then only 64 bytes need to be set aside. table 8.6 (p. 63 ) lists the address bits that the controller uses when it accesses the elements of the channel control data structure. table 8.6. address bit settings for the channel control data structure address bits [8] [7] [6] [5] [4] [3:0] a c[3] c[2] c[1] c[0] 0x0, 0x4, or 0x8 where: a selects one of the channel control data structures: a = 0 selects the primary data structure. a = 1 selects the alternate data structure. c[3:0] selects the dma channel. address[3:0] selects one of the control elements: 0x0 selects the source data end pointer. 0x4 selects the destination data end pointer. 0x8 selects the control data configuration. 0xc the controller does not access this address location. if required, you can enable the host processor to use this memory location as system memory. note it is not necessary for you to calculate the base address of the alternate data structure because the dma_altctrlbase register provides this information.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 64 www.energymicro.com figure 8.7 (p. 64 ) shows a detailed memory map of the descriptor structure. figure 8.7. detailed memory map for the 12 channels, including the alternate data structure 0x000 source end point er dest inat ion end point er cont rol unused source end point er dest inat ion end point er cont rol unused source end point er dest inat ion end point er cont rol unused 0x004 0x008 0x010 0x014 0x018 0x0 b 0 0x0 b 4 0x0 b 8 source end point er dest inat ion end point er cont rol unused 0x 10 0 0x 10 4 0x 10 8 source end point er dest inat ion end point er cont rol unused 0x 11 0 0x 11 4 0x 11 8 source end point er dest inat ion end point er cont rol unused 0x 1 b 0 0x 1 b 4 0x 1 b 8 0x00c 0x01c 0x0 b c 0x 10 c 0x 11 c 0x 1 b c prim ary dat a st ruct ure alt ernat e dat a st ruct ure alt ernat e for channel 11 alt ernat e for channel 1 alt ernat e for channel 0 prim ary for channel 11 prim ary for channel 1 prim ary for channel 0 the controller uses the system memory to enable it to access two pointers and the control information that it requires for each channel. the following subsections will describe these 32-bit memory locations and how the controller calculates the dma transfer address. 8.4.3.1 source data end pointer the src_data_end_ptr memory location contains a pointer to the end address of the source data. figure 8.7 (p. 64 ) lists the bit assignments for this memory location. table 8.7. src_data_end_ptr bit assignments bit name description [31:0] src_data_end_ptr pointer to the end address of the source data before the controller can perform a dma transfer, you must program this memory location with the end address of the source data. the controller reads this memory location when it starts a 2 r dma transfer. note the controller does not write to this memory location. 8.4.3.2 destination data end pointer the dst_data_end_ptr memory location contains a pointer to the end address of the destination data. table 8.8 (p. 65 ) lists the bit assignments for this memory location.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 65 www.energymicro.com table 8.8. dst_data_end_ptr bit assignments bit name description [31:0] dst_data_end_ptr pointer to the end address of the destination data before the controller can perform a dma transfer, you must program this memory location with the end address of the destination data. the controller reads this memory location when it starts a 2 r dma transfer. note the controller does not write to this memory location. 8.4.3.3 control data configuration for each dma transfer, the channel_cfg memory location provides the control information for the controller. figure 8.8 (p. 65 ) shows the bit assignments for this memory location. figure 8.8. channel_cfg bit assignments 31 21 20 13 4 0 dst _inc src_prot _ct rl r_power n_m inus_1 next _useburst 30 29 28 27 26 25 24 23 dst _size src_size src_inc dst _prot _ct rl 18 17 cycle_ct rl 3 14 2 table 8.9 (p. 65 ) lists the bit assignments for this memory location. table 8.9. channel_cfg bit assignments bit name description [31:30] dst_inc destination address increment. the address increment depends on the source data width as follows: source data width = byte b00 = byte. b01 = halfword. b10 = word. b11 = no increment. address remains set to the value that the dst_data_end_ptr memory location contains. source data width = halfword b00 = reserved. b01 = halfword. b10 = word. b11 = no increment. address remains set to the value that the dst_data_end_ptr memory location contains. source data width = word b00 = reserved. b01 = reserved. b10 = word. b11 = no increment. address remains set to the value that the dst_data_end_ptr memory location contains. [29:28] dst_size destination data size. note you must set dst_size to contain the same value that src_size contains. [27:26] src_inc set the bits to control the source address increment. the address increment depends on the source data width as follows:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 66 www.energymicro.com bit name description source data width = byte b00 = byte. b01 = halfword. b10 = word. b11 = no increment. address remains set to the value that the src_data_end_ptr memory location contains. source data width = halfword b00 = reserved. b01 = halfword. b10 = word. b11 = no increment. address remains set to the value that the src_data_end_ptr memory location contains. source data width = word b00 = reserved. b01 = reserved. b10 = word. b11 = no increment. address remains set to the value that the src_data_end_ptr memory location contains. [25:24] src_size set the bits to match the size of the source data: b00 = byte b01 = halfword b10 = word b11 = reserved. [23:21] dst_prot_ctrl set the bits to control the state of hprot when the controller writes the destination data. bit [23] this bit has no effect on the dma. bit [22] this bit has no effect on the dma. bit [21] controls the state of hprot as follows: 0 = hprot is low and the access is non-privileged. 1 = hprot is high and the access is privileged. [20:18] src_prot_ctrl set the bits to control the state of hprot when the controller reads the source data. bit [20] this bit has no effect on the dma. bit [19] this bit has no effect on the dma. bit [18] controls the state of hprot as follows: 0 = hprot is low and the access is non-privileged. 1 = hprot is high and the access is privileged. [17:14] r_power set these bits to control how many dma transfers can occur before the controller re-arbitrates. the possible arbitration rate settings are: b0000 arbitrates after each dma transfer. b0001 arbitrates after 2 dma transfers. b0010 arbitrates after 4 dma transfers. b0011 arbitrates after 8 dma transfers. b0100 arbitrates after 16 dma transfers. b0101 arbitrates after 32 dma transfers. b0110 arbitrates after 64 dma transfers. b0111 arbitrates after 128 dma transfers. b1000 arbitrates after 256 dma transfers. b1001 arbitrates after 512 dma transfers. b1010 - b1111 arbitrates after 1024 dma transfers. this means that no arbitration occurs during the dma transfer because the maximum transfer size is 1024. [13:4] n_minus_1 prior to the dma cycle commencing, these bits represent the total number of dma transfers that the dma cycle contains. you must set these bits according to the size of dma cycle that you require. the 10-bit value indicates the number of dma transfers, minus one. the possible values are: b000000000 = 1 dma transfer
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 67 www.energymicro.com bit name description b000000001 = 2 dma transfers b000000010 = 3 dma transfers b000000011 = 4 dma transfers b000000100 = 5 dma transfers . . . b111111111 = 1024 dma transfers. the controller updates this field immediately prior to it entering the arbitration process. this enables the controller to store the number of outstanding dma transfers that are necessary to complete the dma cycle. [3] next_useburst controls if the chnl_useburst_set [c] bit is set to a 1, when the controller is performing a peripheral scatter-gather and is completing a dma cycle that uses the alternate data structure. note immediately prior to completion of the dma cycle that the alternate data structure specifies, the controller sets the chnl_useburst_set [c] bit to 0 if the number of remaining transfers is less than 2 r . the setting of the next_useburst bit controls if the controller performs an additional modification of the chnl_useburst_set [c] bit. in peripheral scatter-gather dma cycle then after the dma cycle that uses the alternate data structure completes , either: 0 = the controller does not change the value of the chnl_useburst_set [c] bit. if the chnl_useburst_set [c] bit is 0 then for all the remaining dma cycles in the peripheral scatter- gather transaction, the controller responds to requests on dma_req[ ] and dma_sreq[ ] , when it performs a dma cycle that uses an alternate data structure. 1 = the controller sets the chnl_useburst_set [c] bit to a 1. therefore, for the remaining dma cycles in the peripheral scatter-gather transaction, the controller only responds to requests on dma_req[ ] , when it performs a dma cycle that uses an alternate data structure. [2:0] cycle_ctrl the operating mode of the dma cycle. the modes are: b000 stop. indicates that the data structure is invalid. b001 basic. the controller must receive a new request, prior to it entering the arbitration process, to enable the dma cycle to complete. b010 auto-request. the controller automatically inserts a request for the appropriate channel during the arbitration process. this means that the initial request is sufficient to enable the dma cycle to complete. b011 ping-pong. the controller performs a dma cycle using one of the data structures. after the dma cycle completes, it performs a dma cycle using the other data structure. after the dma cycle completes and provided that the host processor has updated the original data structure, it performs a dma cycle using the original data structure. the controller continues to perform dma cycles until it either reads an invalid data structure or the host processor changes the cycle_ctrl bits to b001 or b010. see section 8.4.2.3.4 (p. 55 ) . b100 memory scatter/gather. see section 8.4.2.3.5 (p. 57 ) . when the controller operates in memory scatter-gather mode, you must only use this value in the primary data structure. b101 memory scatter/gather. see section 8.4.2.3.5 (p. 57 ) . when the controller operates in memory scatter-gather mode, you must only use this value in the alternate data structure. b110 peripheral scatter/gather. see section 8.4.2.3.6 (p. 60 ) . when the controller operates in peripheral scatter-gather mode, you must only use this value in the primary data structure. b111 peripheral scatter/gather. see section 8.4.2.3.6 (p. 60 ) . when the controller operates in peripheral scatter-gather mode, you must only use this value in the alternate data structure. at the start of a dma cycle, or 2 r dma transfer, the controller fetches the channel_cfg from system memory. after it performs 2 r , or n, transfers it stores the updated channel_cfg in system memory.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 68 www.energymicro.com the controller does not support a dst_size value that is different to the src_size value. if it detects a mismatch in these values, it uses the src_size value for source and destination and when it next updates the n_minus_1 field, it also sets the dst_size field to the same as the src_size field. after the controller completes the n transfers it sets the cycle_ctrl field to b000, to indicate that the channel_cfg data is invalid. this prevents it from repeating the same dma transfer. 8.4.3.4 address calculation to calculate the source address of a dma transfer, the controller performs a left shift operation on the n_minus_1 value by a shift amount that src_inc specifies, and then subtracts the resulting value from the source data end pointer. similarly, to calculate the destination address of a dma transfer, it performs a left shift operation on the n_minus_1 value by a shift amount that dst_inc specifies, and then subtracts the resulting value from the destination end pointer. depending on the value of src_inc and dst_inc, the source address and destination address can be calculated using the equations: src_inc = b00 and dst_inc = b00 ? source address = src_data_end_ptr - n_minus_1 ? destination address = dst_data_end_ptr - n_minus_1. src_inc = b01 and dst_inc = b01 ? source address = src_data_end_ptr - (n_minus_1 << 1) ? destination address = dst_data_end_ptr - (n_minus_1 << 1). src_inc = b10 and dst_inc = b10 ? source address = src_data_end_ptr - (n_minus_1 << 2) ? destination address = dst_data_end_ptr - (n_minus_1 << 2). src_inc = b11 and dst_inc = b11 ? source address = src_data_end_ptr ? destination address = dst_data_end_ptr. table 8.10 (p. 68 ) lists the destination addresses for a dma cycle of six words. table 8.10. dma cycle of six words using a word increment initial values of channel_cfg, prior to the dma cycle src_size = b10, dst_inc = b10, n_minus_1 = b101, cycle_ctrl = 1 end pointer count difference 1 address 0x2ac 5 0x14 0x298 0x2ac 4 0x10 0x29c 0x2ac 3 0xc 0x2a0 0x2ac 2 0x8 0x2a4 0x2ac 1 0x4 0x2a8 dma transfers 0x2ac 0 0x0 0x2ac final values of channel_cfg, after the dma cycle src_size = b10, dst_inc = b10, n_minus_1 = 0, cycle_ctrl = 0 1 this value is the result of count being shifted left by the value of dst_inc. table 8.11 (p. 68 ) lists the destination addresses for a dma transfer of 12 bytes using a halfword increment. table 8.11. dma cycle of 12 bytes using a halfword increment initial values of channel_cfg, prior to the dma cycle src_size = b00, dst_inc = b01, n_minus_1 = b1011, cycle_ctrl = 1, r_power = b11 end pointer count difference 1 address 0x5e7 11 0x16 0x5d1
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 69 www.energymicro.com 0x5e7 10 0x14 0x5d3 0x5e7 9 0x12 0x5d5 0x5e7 8 0x10 0x5d7 0x5e7 7 0xe 0x5d9 0x5e7 6 0xc 0x5db 0x5e7 5 0xa 0x5dd dma transfers 0x5e7 4 0x8 0x5df values of channel_cfg after 2 r dma transfers src_size = b00, dst_inc = b01, n_minus_1 = b011, cycle_ctrl = 1, r_power = b11 end pointer count difference address 0x5e7 3 0x6 0x5e1 0x5e7 2 0x4 0x5e3 0x5e7 1 0x2 0x5e5 dma transfers 0x5e7 0 0x0 0x5e7 final values of channel_cfg, after the dma cycle src_size = b00, dst_inc = b01, n_minus_1 = 0, cycle_ctrl = 0 2 , r_power = b11 1 this value is the result of count being shifted left by the value of dst_inc. 2 after the controller completes the dma cycle it invalidates the channel_cfg memory location by clearing the cycle_ctrl field. 8.4.4 looped transfers a regular dma channel is done when it has performed the number of transfers given by the channel descriptor. if an application wants a continuous flow of data, one option is to use ping-pong mode, alternating between two descriptors and having software update one descriptor while the other is being used. another way is to use looped transfers. for dma channels 0 and 1, looping can be enabled by setting en in dma_loop0 and dma_loop1 respectively. a looping dma channel will on completion set the respective done interrupt flag, but then reload n_minus_1 in the channel descriptor with the loop width defined by width in dma_loopx and continue transmitting data. the total length of the transfer is given by the original value of n_minus_1 in the channel descriptor and width in dma_loopx times the number of loops taken. the loop feature can for instance be used to implement a ring buffer, contiguously overwriting old data when new data is available. to end the loop clear en in dma_loopx. the channel will then complete the last loop before stopping. 8.4.5 2d copy in addition to looped transfers, dma channel 0 has the ability to do rectangle transfers, or 2d copy. for an application working with graphics, this would mean the ability to copy a rectangle of a given width and height from one picture to another. the dma also has the ability to copy from linear data to a rectangle, and from a rectangle to linear data. to set up rectangle copy for dma channel 0, configure width in dma_loop0 to one less than the rectangle width, and height in dma_rect0 to one less than the rectangle height. then set srcstride in dma_rect0 to the outer rectangle width of the source, and dststride in dma_rect0 to the outer rectangle width of the destination rectangle. finally, the channel descriptor for channel 0 has to be configured. the source and destination end pointers should be set to the last element of the first line of the source data and destination data respectively. the number of elements to be transferred, n_minus_1 should be set equal to width in dma_loop0. the parameters are visualized in figure 8.9 (p. 70 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 70 www.energymicro.com figure 8.9. 2d copy source buffer dest inat ion buffer srcstride dststride width height width height source end point er dest inat ion end point er when doing a rectangle copy, the source and destination address of the channel descriptor will be incremented line for line as the dma works its way through the rectangle. the operation is done when the number of lines specified by height in dma_rect0 has been copied. the source and destination addresses in the channel descriptor will then point at the last element of the source and destination rectangles. on completion, the done interrupt flag of channel 0 is set. looping is not supported for rectangle copy. in some cases, e.g. when performing graphics operations, it is desirable to create a list of copy operations and have them executed automatically. this can be done using 2d copy together with the scatter gather mode of the dma controller. set descrect in dma_ctrl to override scrstride and height in dma_rect0 and width in dma_loop0 by the values in the user part of the dma descriptor as shown in table 8.12 (p. 70 ) . in this way every copy command in the list can specify these parameters individually. table 8.12. user data assignments when descrect is set bit field description [30:20] srcstride stride in source buffer [19:10] height height - 1 of data to be copied [9:0] width width - 1 of data to be copied with regular 2d copy, the dma descriptor will be updated as the copy operation proceeds. to be able to reuse 2d copy scatter gather list without rewriting source and destination end addresses, set prdu in dma_ctrl. this will prevent the address in the descriptor from being updated. in this case rdsch0 in dma_rds must be set and all other bits in dma_rds must be cleared. the bits in dma_rds make individual dma channels remember the source and destination end pointers while active, speeding up their transfers. 8.4.6 interaction with the emu the dma interacts with the energy management unit (emu) to allow transfers from , e.g., the leuart to occur in em2. the emu can wake up the dma sufficiently long to allow data transfers to occur. see section "dma support" in the leuart documentation.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 71 www.energymicro.com 8.4.7 interrupts the pl230 dma_done[n:0] signals (one for each channel) as well as the dma_err signal, are available as interrupts to the cortex-m4 core. they are combined into one interrupt vector, dma_int. if the interrupt for the dma is enabled in the arm cortex-m4 core, an interrupt will be made if one or more of the interrupt flags in dma_if and their corresponding bits in dma_ien are set. 8.5 examples a basic example of how to program the dma for transferring 42 bytes from the usart1 to memory location 0x20003420. assumes that the channel 0 is currently disabled, and that the dma_altctrlbase register has already been configured. example 8.1. dma transfer 1. configure the channel select for using usart1 with dma channel 0 a. write sourcesel=0b001101 and sigsel=xx to dma_chctrl0 2. configure the primary channel descriptor for dma channel 0 a. write xx (read address of usart1) to src_data_end_ptr b. write 0x20003420 + 40 to dst_data_end_ptr c c. write these values to channel_cfg for channel 0: i. dst_inc=b01 (destination halfword address increment) ii. dst_size=b01 (halfword transfer size) iii. src_inc=b11 (no address increment for source) iv. src_size=01 (halfword transfer size) v. dst_prot_ctrl=000 (no cache/buffer/privilege) vi. src_prot_ctrl=000 (no cache/buffer/privilege) vii. r_power=b0000 (arbitrate after each dma transfer) viii. n_minus_1=d20 (transfer 21 halfwords) ix. next_useburst=b0 (not applicable) x. cycle_ctrl=b001 (basic operating mode) 3. enable the dma a. write en=1 to dma_config 4. disable the single requests for channel 0 (i.e., do not react to data available, wait for buffer full) a. write dma_chusebursts[0]=1 5. enable buffer-full requests for channel 0 a. write dma_chreqmaskc[0]=1 6. use the primary data structure for channel 0 a. write dma_chaltc[0]=1 7. enable channel 0 a. write dma_chens[0]=1
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 72 www.energymicro.com 8.6 register map the offset register address is relative to the registers base address. offset name type description 0x000 dma_status r dma status registers 0x004 dma_config w dma configuration register 0x008 dma_ctrlbase rw channel control data base pointer register 0x00c dma_altctrlbase r channel alternate control data base pointer register 0x010 dma_chwaitstatus r channel wait on request status register 0x014 dma_chswreq w1 channel software request register 0x018 dma_chusebursts rw1 channel useburst set register 0x01c dma_chuseburstc w1 channel useburst clear register 0x020 dma_chreqmasks rw1 channel request mask set register 0x024 dma_chreqmaskc w1 channel request mask clear register 0x028 dma_chens rw1 channel enable set register 0x02c dma_chenc w1 channel enable clear register 0x030 dma_chalts rw1 channel alternate set register 0x034 dma_chaltc w1 channel alternate clear register 0x038 dma_chpris rw1 channel priority set register 0x03c dma_chpric w1 channel priority clear register 0x04c dma_errorc rw bus error clear register 0xe10 dma_chreqstatus r channel request status 0xe18 dma_chsreqstatus r channel single request status 0x1000 dma_if r interrupt flag register 0x1004 dma_ifs w1 interrupt flag set register 0x1008 dma_ifc w1 interrupt flag clear register 0x100c dma_ien rw interrupt enable register 0x1010 dma_ctrl rw dma control register 0x1014 dma_rds rw dma retain descriptor state 0x1020 dma_loop0 rwh channel 0 loop register 0x1024 dma_loop1 rw channel 1 loop register 0x1060 dma_rect0 rwh channel 0 rectangle register 0x1100 dma_ch0_ctrl rw channel control register ... dma_chx_ctrl rw channel control register 0x112c dma_ch11_ctrl rw channel control register
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 73 www.energymicro.com 8.7 register description 8.7.1 dma_status - dma status registers offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0b 0x0 0 access r r r name chnum state en bit name reset access description 31:21 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 20:16 chnum 0x0b r channel number number of available dma channels minus one. 15:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:4 state 0x0 r control current state state can be one of the following. higher values (11-15) are undefined. value mode description 0 idle idle 1 rdchctrldata reading channel controller data 2 rdsrcendptr reading source data end pointer 3 rddstendptr reading destination data end pointer 4 rdsrcdata reading source data 5 wrdstdata writing destination data 6 waitreqclr waiting for dma request to clear 7 wrchctrldata writing channel controller data 8 stalled stalled 9 done done 10 perscattrans peripheral scatter-gather transition 3:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 en 0 r dma enable status when this bit is 1, the dma is enabled. 8.7.2 dma_config - dma configuration register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w w name chprot en bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 74 www.energymicro.com bit name reset access description 5 chprot 0 w channel protection control control whether accesses done by the dma controller are privileged or not. when chprot = 1 then hprot is high and the access is privileged. when chprot = 0 then hprot is low and the access is non-privileged. 4:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 en 0 w enable dma set this bit to enable the dma controller. 8.7.3 dma_ctrlbase - channel control data base pointer register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name ctrlbase bit name reset access description 31:0 ctrlbase 0x00000000 rw channel control data base pointer the base pointer for a location in system memory that holds the channel control data structure. this register must be written to point to a location in system memory with the channel control data structure before the dma can be used. note that ctrl_base_ptr[8:0] must be 0. 8.7.4 dma_altctrlbase - channel alternate control data base pointer register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000100 access r name altctrlbase bit name reset access description 31:0 altctrlbase 0x00000100 r channel alternate control data base pointer
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 75 www.energymicro.com bit name reset access description the base address of the alternate data structure. this register will read as dma_ctrlbase + 0x100. 8.7.5 dma_chwaitstatus - channel wait on request status register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 1 1 1 1 1 1 1 1 1 1 1 access r r r r r r r r r r r r name ch11waitstatus ch10waitstatus ch9waitstatus ch8waitstatus ch7waitstatus ch6waitstatus ch5waitstatus ch4waitstatus ch3waitstatus ch2waitstatus ch1waitstatus ch0waitstatus bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11waitstatus 1 r channel 11 wait on request status status for wait on request for channel 11. 10 ch10waitstatus 1 r channel 10 wait on request status status for wait on request for channel 10. 9 ch9waitstatus 1 r channel 9 wait on request status status for wait on request for channel 9. 8 ch8waitstatus 1 r channel 8 wait on request status status for wait on request for channel 8. 7 ch7waitstatus 1 r channel 7 wait on request status status for wait on request for channel 7. 6 ch6waitstatus 1 r channel 6 wait on request status status for wait on request for channel 6. 5 ch5waitstatus 1 r channel 5 wait on request status status for wait on request for channel 5. 4 ch4waitstatus 1 r channel 4 wait on request status status for wait on request for channel 4. 3 ch3waitstatus 1 r channel 3 wait on request status status for wait on request for channel 3. 2 ch2waitstatus 1 r channel 2 wait on request status status for wait on request for channel 2. 1 ch1waitstatus 1 r channel 1 wait on request status status for wait on request for channel 1. 0 ch0waitstatus 1 r channel 0 wait on request status status for wait on request for channel 0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 76 www.energymicro.com 8.7.6 dma_chswreq - channel software request register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name ch11swreq ch10swreq ch9swreq ch8swreq ch7swreq ch6swreq ch5swreq ch4swreq ch3swreq ch2swreq ch1swreq ch0swreq bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11swreq 0 w1 channel 11 software request write 1 to this bit to generate a dma request for this channel. 10 ch10swreq 0 w1 channel 10 software request write 1 to this bit to generate a dma request for this channel. 9 ch9swreq 0 w1 channel 9 software request write 1 to this bit to generate a dma request for this channel. 8 ch8swreq 0 w1 channel 8 software request write 1 to this bit to generate a dma request for this channel. 7 ch7swreq 0 w1 channel 7 software request write 1 to this bit to generate a dma request for this channel. 6 ch6swreq 0 w1 channel 6 software request write 1 to this bit to generate a dma request for this channel. 5 ch5swreq 0 w1 channel 5 software request write 1 to this bit to generate a dma request for this channel. 4 ch4swreq 0 w1 channel 4 software request write 1 to this bit to generate a dma request for this channel. 3 ch3swreq 0 w1 channel 3 software request write 1 to this bit to generate a dma request for this channel. 2 ch2swreq 0 w1 channel 2 software request write 1 to this bit to generate a dma request for this channel. 1 ch1swreq 0 w1 channel 1 software request write 1 to this bit to generate a dma request for this channel. 0 ch0swreq 0 w1 channel 0 software request write 1 to this bit to generate a dma request for this channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 77 www.energymicro.com 8.7.7 dma_chusebursts - channel useburst set register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 name ch11usebursts ch10usebursts ch9usebursts ch8usebursts ch7usebursts ch6usebursts ch5usebursts ch4usebursts ch3usebursts ch2usebursts ch1usebursts ch0usebursts bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11usebursts 0 rw1 channel 11 useburst set see description for channel 0. 10 ch10usebursts 0 rw1 channel 10 useburst set see description for channel 0. 9 ch9usebursts 0 rw1 channel 9 useburst set see description for channel 0. 8 ch8usebursts 0 rw1 channel 8 useburst set see description for channel 0. 7 ch7usebursts 0 rw1 channel 7 useburst set see description for channel 0. 6 ch6usebursts 0 rw1 channel 6 useburst set see description for channel 0. 5 ch5usebursts 0 rw1 channel 5 useburst set see description for channel 0. 4 ch4usebursts 0 rw1 channel 4 useburst set see description for channel 0. 3 ch3usebursts 0 rw1 channel 3 useburst set see description for channel 0. 2 ch2usebursts 0 rw1 channel 2 useburst set see description for channel 0. 1 ch1usebursts 0 rw1 channel 1 useburst set see description for channel 0. 0 ch0usebursts 0 rw1 channel 0 useburst set write to 1 to enable the useburst setting for this channel. reading returns the useburst status. after the penultimate 2^r transfer completes, if the number of remaining transfers, n, is less than 2^r then the controller resets the chnl_useburst_set bit to 0. this enables you to complete the remaining transfers using dma_req[] or dma_sreq[]. in peripheral scatter-gather mode, if the next_useburst bit is set in channel_cfg then the controller sets the chnl_useburst_set[c] bit to a 1, when it completes the dma cycle that uses the alternate data structure. value mode description 0 singleandburst channel responds to both single and burst requests 1 burstonly channel responds to burst requests only
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 78 www.energymicro.com 8.7.8 dma_chuseburstc - channel useburst clear register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name ch11useburstc ch10useburstc ch9useburstc ch08useburstc ch7useburstc ch6useburstc ch5useburstc ch4useburstc ch3useburstc ch2useburstc ch1useburstc ch0useburstc bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11useburstc 0 w1 channel 11 useburst clear write to 1 to disable useburst setting for this channel. 10 ch10useburstc 0 w1 channel 10 useburst clear write to 1 to disable useburst setting for this channel. 9 ch9useburstc 0 w1 channel 9 useburst clear write to 1 to disable useburst setting for this channel. 8 ch08useburstc 0 w1 channel 8 useburst clear write to 1 to disable useburst setting for this channel. 7 ch7useburstc 0 w1 channel 7 useburst clear write to 1 to disable useburst setting for this channel. 6 ch6useburstc 0 w1 channel 6 useburst clear write to 1 to disable useburst setting for this channel. 5 ch5useburstc 0 w1 channel 5 useburst clear write to 1 to disable useburst setting for this channel. 4 ch4useburstc 0 w1 channel 4 useburst clear write to 1 to disable useburst setting for this channel. 3 ch3useburstc 0 w1 channel 3 useburst clear write to 1 to disable useburst setting for this channel. 2 ch2useburstc 0 w1 channel 2 useburst clear write to 1 to disable useburst setting for this channel. 1 ch1useburstc 0 w1 channel 1 useburst clear write to 1 to disable useburst setting for this channel. 0 ch0useburstc 0 w1 channel 0 useburst clear write to 1 to disable useburst setting for this channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 79 www.energymicro.com 8.7.9 dma_chreqmasks - channel request mask set register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 name ch11reqmasks ch10reqmasks ch9reqmasks ch8reqmasks ch7reqmasks ch6reqmasks ch5reqmasks ch4reqmasks ch3reqmasks ch2reqmasks ch1reqmasks ch0reqmasks bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11reqmasks 0 rw1 channel 11 request mask set write to 1 to disable peripheral requests for this channel. 10 ch10reqmasks 0 rw1 channel 10 request mask set write to 1 to disable peripheral requests for this channel. 9 ch9reqmasks 0 rw1 channel 9 request mask set write to 1 to disable peripheral requests for this channel. 8 ch8reqmasks 0 rw1 channel 8 request mask set write to 1 to disable peripheral requests for this channel. 7 ch7reqmasks 0 rw1 channel 7 request mask set write to 1 to disable peripheral requests for this channel. 6 ch6reqmasks 0 rw1 channel 6 request mask set write to 1 to disable peripheral requests for this channel. 5 ch5reqmasks 0 rw1 channel 5 request mask set write to 1 to disable peripheral requests for this channel. 4 ch4reqmasks 0 rw1 channel 4 request mask set write to 1 to disable peripheral requests for this channel. 3 ch3reqmasks 0 rw1 channel 3 request mask set write to 1 to disable peripheral requests for this channel. 2 ch2reqmasks 0 rw1 channel 2 request mask set write to 1 to disable peripheral requests for this channel. 1 ch1reqmasks 0 rw1 channel 1 request mask set write to 1 to disable peripheral requests for this channel. 0 ch0reqmasks 0 rw1 channel 0 request mask set write to 1 to disable peripheral requests for this channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 80 www.energymicro.com 8.7.10 dma_chreqmaskc - channel request mask clear register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name ch11reqmaskc ch10reqmaskc ch9reqmaskc ch8reqmaskc ch7reqmaskc ch6reqmaskc ch5reqmaskc ch4reqmaskc ch3reqmaskc ch2reqmaskc ch1reqmaskc ch0reqmaskc bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11reqmaskc 0 w1 channel 11 request mask clear write to 1 to enable peripheral requests for this channel. 10 ch10reqmaskc 0 w1 channel 10 request mask clear write to 1 to enable peripheral requests for this channel. 9 ch9reqmaskc 0 w1 channel 9 request mask clear write to 1 to enable peripheral requests for this channel. 8 ch8reqmaskc 0 w1 channel 8 request mask clear write to 1 to enable peripheral requests for this channel. 7 ch7reqmaskc 0 w1 channel 7 request mask clear write to 1 to enable peripheral requests for this channel. 6 ch6reqmaskc 0 w1 channel 6 request mask clear write to 1 to enable peripheral requests for this channel. 5 ch5reqmaskc 0 w1 channel 5 request mask clear write to 1 to enable peripheral requests for this channel. 4 ch4reqmaskc 0 w1 channel 4 request mask clear write to 1 to enable peripheral requests for this channel. 3 ch3reqmaskc 0 w1 channel 3 request mask clear write to 1 to enable peripheral requests for this channel. 2 ch2reqmaskc 0 w1 channel 2 request mask clear write to 1 to enable peripheral requests for this channel. 1 ch1reqmaskc 0 w1 channel 1 request mask clear write to 1 to enable peripheral requests for this channel. 0 ch0reqmaskc 0 w1 channel 0 request mask clear write to 1 to enable peripheral requests for this channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 81 www.energymicro.com 8.7.11 dma_chens - channel enable set register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 name ch11ens ch10ens ch9ens ch8ens ch7ens ch6ens ch5ens ch4ens ch3ens ch2ens ch1ens ch0ens bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11ens 0 rw1 channel 11 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 10 ch10ens 0 rw1 channel 10 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 9 ch9ens 0 rw1 channel 9 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 8 ch8ens 0 rw1 channel 8 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 7 ch7ens 0 rw1 channel 7 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 6 ch6ens 0 rw1 channel 6 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 5 ch5ens 0 rw1 channel 5 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 4 ch4ens 0 rw1 channel 4 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 3 ch3ens 0 rw1 channel 3 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 2 ch2ens 0 rw1 channel 2 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 1 ch1ens 0 rw1 channel 1 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 0 ch0ens 0 rw1 channel 0 enable set write to 1 to enable this channel. reading returns the enable status of the channel. 8.7.12 dma_chenc - channel enable clear register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name ch11enc ch10enc ch9enc ch8enc ch7enc ch6enc ch5enc ch4enc ch3enc ch2enc ch1enc ch0enc
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 82 www.energymicro.com bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11enc 0 w1 channel 11 enable clear write to 1 to disable this channel. see also description for channel 0. 10 ch10enc 0 w1 channel 10 enable clear write to 1 to disable this channel. see also description for channel 0. 9 ch9enc 0 w1 channel 9 enable clear write to 1 to disable this channel. see also description for channel 0. 8 ch8enc 0 w1 channel 8 enable clear write to 1 to disable this channel. see also description for channel 0. 7 ch7enc 0 w1 channel 7 enable clear write to 1 to disable this channel. see also description for channel 0. 6 ch6enc 0 w1 channel 6 enable clear write to 1 to disable this channel. see also description for channel 0. 5 ch5enc 0 w1 channel 5 enable clear write to 1 to disable this channel. see also description for channel 0. 4 ch4enc 0 w1 channel 4 enable clear write to 1 to disable this channel. see also description for channel 0. 3 ch3enc 0 w1 channel 3 enable clear write to 1 to disable this channel. see also description for channel 0. 2 ch2enc 0 w1 channel 2 enable clear write to 1 to disable this channel. see also description for channel 0. 1 ch1enc 0 w1 channel 1 enable clear write to 1 to disable this channel. see also description for channel 0. 0 ch0enc 0 w1 channel 0 enable clear write to 1 to disable this channel. note that the controller disables a channel, by setting the appropriate bit, when either it completes the dma cycle, or it reads a channel_cfg memory location which has cycle_ctrl = b000, or an error occurs on the ahb-lite bus. 8.7.13 dma_chalts - channel alternate set register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 name ch11alts ch10alts ch9alts ch8alts ch7alts ch6alts ch5alts ch4alts ch3alts ch2alts ch1alts ch0alts bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11alts 0 rw1 channel 11 alternate structure set write to 1 to select the alternate structure for this channel. 10 ch10alts 0 rw1 channel 10 alternate structure set write to 1 to select the alternate structure for this channel. 9 ch9alts 0 rw1 channel 9 alternate structure set
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 83 www.energymicro.com bit name reset access description write to 1 to select the alternate structure for this channel. 8 ch8alts 0 rw1 channel 8 alternate structure set write to 1 to select the alternate structure for this channel. 7 ch7alts 0 rw1 channel 7 alternate structure set write to 1 to select the alternate structure for this channel. 6 ch6alts 0 rw1 channel 6 alternate structure set write to 1 to select the alternate structure for this channel. 5 ch5alts 0 rw1 channel 5 alternate structure set write to 1 to select the alternate structure for this channel. 4 ch4alts 0 rw1 channel 4 alternate structure set write to 1 to select the alternate structure for this channel. 3 ch3alts 0 rw1 channel 3 alternate structure set write to 1 to select the alternate structure for this channel. 2 ch2alts 0 rw1 channel 2 alternate structure set write to 1 to select the alternate structure for this channel. 1 ch1alts 0 rw1 channel 1 alternate structure set write to 1 to select the alternate structure for this channel. 0 ch0alts 0 rw1 channel 0 alternate structure set write to 1 to select the alternate structure for this channel. 8.7.14 dma_chaltc - channel alternate clear register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name ch11altc ch10altc ch9altc ch8altc ch7altc ch6altc ch5altc ch4altc ch3altc ch2altc ch1altc ch0altc bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11altc 0 w1 channel 11 alternate clear write to 1 to select the primary structure for this channel. 10 ch10altc 0 w1 channel 10 alternate clear write to 1 to select the primary structure for this channel. 9 ch9altc 0 w1 channel 9 alternate clear write to 1 to select the primary structure for this channel. 8 ch8altc 0 w1 channel 8 alternate clear write to 1 to select the primary structure for this channel. 7 ch7altc 0 w1 channel 7 alternate clear write to 1 to select the primary structure for this channel. 6 ch6altc 0 w1 channel 6 alternate clear write to 1 to select the primary structure for this channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 84 www.energymicro.com bit name reset access description 5 ch5altc 0 w1 channel 5 alternate clear write to 1 to select the primary structure for this channel. 4 ch4altc 0 w1 channel 4 alternate clear write to 1 to select the primary structure for this channel. 3 ch3altc 0 w1 channel 3 alternate clear write to 1 to select the primary structure for this channel. 2 ch2altc 0 w1 channel 2 alternate clear write to 1 to select the primary structure for this channel. 1 ch1altc 0 w1 channel 1 alternate clear write to 1 to select the primary structure for this channel. 0 ch0altc 0 w1 channel 0 alternate clear write to 1 to select the primary structure for this channel. 8.7.15 dma_chpris - channel priority set register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 name ch11pris ch10pris ch9pris ch8pris ch7pris ch6pris ch5pris ch4pris ch3pris ch2pris ch1pris ch0pris bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11pris 0 rw1 channel 11 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 10 ch10pris 0 rw1 channel 10 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 9 ch9pris 0 rw1 channel 9 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 8 ch8pris 0 rw1 channel 8 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 7 ch7pris 0 rw1 channel 7 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 6 ch6pris 0 rw1 channel 6 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 5 ch5pris 0 rw1 channel 5 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 4 ch4pris 0 rw1 channel 4 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 3 ch3pris 0 rw1 channel 3 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 2 ch2pris 0 rw1 channel 2 high priority set
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 85 www.energymicro.com bit name reset access description write to 1 to obtain high priority for this channel. reading returns the channel priority status. 1 ch1pris 0 rw1 channel 1 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 0 ch0pris 0 rw1 channel 0 high priority set write to 1 to obtain high priority for this channel. reading returns the channel priority status. 8.7.16 dma_chpric - channel priority clear register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name ch11pric ch10pric ch9pric ch8pric ch7pric ch6pric ch5pric ch4pric ch3pric ch2pric ch1pric ch0pric bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11pric 0 w1 channel 11 high priority clear write to 1 to clear high priority for this channel. 10 ch10pric 0 w1 channel 10 high priority clear write to 1 to clear high priority for this channel. 9 ch9pric 0 w1 channel 9 high priority clear write to 1 to clear high priority for this channel. 8 ch8pric 0 w1 channel 8 high priority clear write to 1 to clear high priority for this channel. 7 ch7pric 0 w1 channel 7 high priority clear write to 1 to clear high priority for this channel. 6 ch6pric 0 w1 channel 6 high priority clear write to 1 to clear high priority for this channel. 5 ch5pric 0 w1 channel 5 high priority clear write to 1 to clear high priority for this channel. 4 ch4pric 0 w1 channel 4 high priority clear write to 1 to clear high priority for this channel. 3 ch3pric 0 w1 channel 3 high priority clear write to 1 to clear high priority for this channel. 2 ch2pric 0 w1 channel 2 high priority clear write to 1 to clear high priority for this channel. 1 ch1pric 0 w1 channel 1 high priority clear write to 1 to clear high priority for this channel. 0 ch0pric 0 w1 channel 0 high priority clear write to 1 to clear high priority for this channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 86 www.energymicro.com 8.7.17 dma_errorc - bus error clear register offset bit position 0x04c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name errorc bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 errorc 0 rw bus error clear this bit is set high if an ahb bus error has occurred. writing a 1 to this bit will clear the bit. if the error is deasserted at the same time as an error occurs on the bus, the error condition takes precedence and errorc remains asserted. 8.7.18 dma_chreqstatus - channel request status offset bit position 0xe10 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access r r r r r r r r r r r r name ch11reqstatus ch10reqstatus ch9reqstatus ch8reqstatus ch7reqstatus ch6reqstatus ch5reqstatus ch4reqstatus ch3reqstatus ch2reqstatus ch1reqstatus ch0reqstatus bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11reqstatus 0 r channel 11 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 10 ch10reqstatus 0 r channel 10 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 9 ch9reqstatus 0 r channel 9 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 8 ch8reqstatus 0 r channel 8 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 7 ch7reqstatus 0 r channel 7 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 6 ch6reqstatus 0 r channel 6 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 87 www.energymicro.com bit name reset access description 5 ch5reqstatus 0 r channel 5 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 4 ch4reqstatus 0 r channel 4 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 3 ch3reqstatus 0 r channel 3 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 2 ch2reqstatus 0 r channel 2 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 1 ch1reqstatus 0 r channel 1 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 0 ch0reqstatus 0 r channel 0 request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using 2 r dma transfers. 8.7.19 dma_chsreqstatus - channel single request status offset bit position 0xe18 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access r r r r r r r r r r r r name ch11sreqstatus ch10sreqstatus ch9sreqstatus ch8sreqstatus ch7sreqstatus ch6sreqstatus ch5sreqstatus ch4sreqstatus ch3sreqstatus ch2sreqstatus ch1sreqstatus ch0sreqstatus bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11sreqstatus 0 r channel 11 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 10 ch10sreqstatus 0 r channel 10 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 9 ch9sreqstatus 0 r channel 9 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 8 ch8sreqstatus 0 r channel 8 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 7 ch7sreqstatus 0 r channel 7 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 6 ch6sreqstatus 0 r channel 6 single request status
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 88 www.energymicro.com bit name reset access description when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 5 ch5sreqstatus 0 r channel 5 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 4 ch4sreqstatus 0 r channel 4 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 3 ch3sreqstatus 0 r channel 3 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 2 ch2sreqstatus 0 r channel 2 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 1 ch1sreqstatus 0 r channel 1 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 0 ch0sreqstatus 0 r channel 0 single request status when this bit is 1, it indicates that the peripheral connected as the input to this dma channel is requesting the controller to service the dma channel. the controller services the request by performing the dma cycle using single dma transfers. 8.7.20 dma_if - interrupt flag register offset bit position 0x1000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 access r r r r r r r r r r r r r name err ch11done ch10done ch9done ch8done ch7done ch6done ch5done ch4done ch3done ch2done ch1done ch0done bit name reset access description 31 err 0 r dma error interrupt flag this flag is set when an error has occurred on the ahb bus. 30:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11done 0 r dma channel 11 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 10 ch10done 0 r dma channel 10 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 9 ch9done 0 r dma channel 9 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 8 ch8done 0 r dma channel 8 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 7 ch7done 0 r dma channel 7 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 6 ch6done 0 r dma channel 6 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 5 ch5done 0 r dma channel 5 complete interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 89 www.energymicro.com bit name reset access description set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 4 ch4done 0 r dma channel 4 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 3 ch3done 0 r dma channel 3 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 2 ch2done 0 r dma channel 2 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 1 ch1done 0 r dma channel 1 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 0 ch0done 0 r dma channel 0 complete interrupt flag set when the dma channel has completed its transfer. if the channel is disabled, the flag is set when there is a request for the channel. 8.7.21 dma_ifs - interrupt flag set register offset bit position 0x1004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name err ch11done ch10done ch9done ch8done ch7done ch6done ch5done ch4done ch3done ch2done ch1done ch0done bit name reset access description 31 err 0 w1 dma error interrupt flag set set to 1 to set dma error interrupt flag. 30:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11done 0 w1 dma channel 11 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 10 ch10done 0 w1 dma channel 10 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 9 ch9done 0 w1 dma channel 9 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 8 ch8done 0 w1 dma channel 8 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 7 ch7done 0 w1 dma channel 7 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 6 ch6done 0 w1 dma channel 6 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 5 ch5done 0 w1 dma channel 5 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 4 ch4done 0 w1 dma channel 4 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 3 ch3done 0 w1 dma channel 3 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 2 ch2done 0 w1 dma channel 2 complete interrupt flag set
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 90 www.energymicro.com bit name reset access description write to 1 to set the corresponding dma channel complete interrupt flag. 1 ch1done 0 w1 dma channel 1 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 0 ch0done 0 w1 dma channel 0 complete interrupt flag set write to 1 to set the corresponding dma channel complete interrupt flag. 8.7.22 dma_ifc - interrupt flag clear register offset bit position 0x1008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name err ch11done ch10done ch9done ch8done ch7done ch6done ch5done ch4done ch3done ch2done ch1done ch0done bit name reset access description 31 err 0 w1 dma error interrupt flag clear set to 1 to clear dma error interrupt flag. note that if an error happened, the bus error clear register must be used to clear the dma. 30:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11done 0 w1 dma channel 11 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 10 ch10done 0 w1 dma channel 10 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 9 ch9done 0 w1 dma channel 9 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 8 ch8done 0 w1 dma channel 8 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 7 ch7done 0 w1 dma channel 7 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 6 ch6done 0 w1 dma channel 6 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 5 ch5done 0 w1 dma channel 5 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 4 ch4done 0 w1 dma channel 4 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 3 ch3done 0 w1 dma channel 3 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 2 ch2done 0 w1 dma channel 2 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 1 ch1done 0 w1 dma channel 1 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag. 0 ch0done 0 w1 dma channel 0 complete interrupt flag clear write to 1 to clear the corresponding dma channel complete interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 91 www.energymicro.com 8.7.23 dma_ien - interrupt enable register offset bit position 0x100c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw name err ch11done ch10done ch9done ch8done ch7done ch6done ch5done ch4done ch3done ch2done ch1done ch0done bit name reset access description 31 err 0 rw dma error interrupt flag enable set this bit to enable interrupt on ahb bus error. 30:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11done 0 rw dma channel 11 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 10 ch10done 0 rw dma channel 10 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 9 ch9done 0 rw dma channel 9 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 8 ch8done 0 rw dma channel 8 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 7 ch7done 0 rw dma channel 7 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 6 ch6done 0 rw dma channel 6 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 5 ch5done 0 rw dma channel 5 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 4 ch4done 0 rw dma channel 4 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 3 ch3done 0 rw dma channel 3 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 2 ch2done 0 rw dma channel 2 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 1 ch1done 0 rw dma channel 1 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt. 0 ch0done 0 rw dma channel 0 complete interrupt enable write to 1 to enable complete interrupt on this dma channel. clear to disable the interrupt.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 92 www.energymicro.com 8.7.24 dma_ctrl - dma control register offset bit position 0x1010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access rw rw name prdu descrect bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 prdu 0 rw prevent rect descriptor update allows the reuse of a rect descriptor. when active ch0 and no others can have rds set 0 descrect 0 rw descriptor specifies rectangle word 4 in dma descriptor specifies width, height and srcstride for rectangle copies. width is given by bits 9:0, height is given by bits 19:10, and srcstride is given by bits 30:20 8.7.25 dma_rds - dma retain descriptor state offset bit position 0x1014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw name rdsch11 rdsch10 rdsch9 rdsch8 rdsch7 rdsch6 rdsch5 rdsch4 rdsch3 rdsch2 rdsch1 rdsch0 bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 rdsch11 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 10 rdsch10 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 9 rdsch9 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 8 rdsch8 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 7 rdsch7 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 6 rdsch6 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 93 www.energymicro.com bit name reset access description 5 rdsch5 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 4 rdsch4 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 3 rdsch3 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 2 rdsch2 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 1 rdsch1 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 0 rdsch0 0 rw retain descriptor state speed up execution of consecutive dma requests from the same channel by not reading descriptor at the start of every arbitration cycle if the next channel is the same as the previous 8.7.26 dma_loop0 - channel 0 loop register offset bit position 0x1020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x000 access rw rwh name en width bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 en 0 rw dma channel 0 loop enable loop enable for channel 0 15:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:0 width 0x000 rwh loop width reload value for n_minus_1 when loop is enabled
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 94 www.energymicro.com 8.7.27 dma_loop1 - channel 1 loop register offset bit position 0x1024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x000 access rw rw name en width bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 en 0 rw dma channel 1 loop enable loop enable for channel 1 15:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:0 width 0x000 rw dma channel 1 loop width reload value for n_minus_1 when loop is enabled 8.7.28 dma_rect0 - channel 0 rectangle register offset bit position 0x1060 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 0x000 0x000 access rw rwh rwh name dststride srcstride height bit name reset access description 31:21 dststride 0x000 rw dma channel 0 destination stride space between start of lines in destination rectangle 20:10 srcstride 0x000 rwh dma channel 0 source stride space between start of lines in source rectangle 9:0 height 0x000 rwh dma channel 0 rectangle height number of lines when doing rectangle copy. set to the number of lines - 1.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 95 www.energymicro.com 8.7.29 dma_chx_ctrl - channel control register offset bit position 0x1100 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x0 access rw rw name sourcesel sigsel bit name reset access description 31:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21:16 sourcesel 0x00 rw source select select input source to dma channel. value mode description 0b000000 none no source selected 0b001000 adc0 analog to digital converter 0 0b001010 dac0 digital to analog converter 0 0b001100 usart0 universal synchronous/asynchronous receiver/transmitter 0 0b001101 usart1 universal synchronous/asynchronous receiver/transmitter 1 0b001110 usart2 universal synchronous/asynchronous receiver/transmitter 2 0b010000 leuart0 low energy uart 0 0b010001 leuart1 low energy uart 1 0b010100 i2c0 i2c 0 0b010101 i2c1 i2c 1 0b011000 timer0 timer 0 0b011001 timer1 timer 1 0b011010 timer2 timer 2 0b011011 timer3 timer 3 0b101100 uart0 universal asynchronous receiver/transmitter 0 0b101101 uart1 universal asynchronous receiver/transmitter 0 0b110000 msc 0b110001 aes advanced encryption standard accelerator 0b110010 lesense low energy sensor interface 0b110011 ebi external bus interface 15:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 sigsel 0x0 rw signal select select input signal to dma channel. value mode description sourcesel = 0b000000 (none) 0bxxxx off channel input selection is turned off sourcesel = 0b001000 (adc0) 0b0000 adc0single adc0single 0b0001 adc0scan adc0scan sourcesel = 0b001010 (dac0) 0b0000 dac0ch0 dac0ch0 0b0001 dac0ch1 dac0ch1 sourcesel = 0b001100 (usart0) 0b0000 usart0rxdatav usart0rxdatav req/sreq 0b0001 usart0txbl usart0txbl req/sreq 0b0010 usart0txempty usart0txempty
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 96 www.energymicro.com bit name reset access description value mode description sourcesel = 0b001101 (usart1) 0b0000 usart1rxdatav usart1rxdatav req/sreq 0b0001 usart1txbl usart1txbl req/sreq 0b0010 usart1txempty usart1txempty 0b0011 usart1rxdatavright usart1rxdatavright req/sreq 0b0100 usart1txblright usart1txblright req/sreq sourcesel = 0b001110 (usart2) 0b0000 usart2rxdatav usart2rxdatav req/sreq 0b0001 usart2txbl usart2txbl req/sreq 0b0010 usart2txempty usart2txempty 0b0011 usart2rxdatavright usart2rxdatavright req/sreq 0b0100 usart2txblright usart2txblright req/sreq sourcesel = 0b010000 (leuart0) 0b0000 leuart0rxdatav leuart0rxdatav 0b0001 leuart0txbl leuart0txbl 0b0010 leuart0txempty leuart0txempty sourcesel = 0b010001 (leuart1) 0b0000 leuart1rxdatav leuart1rxdatav 0b0001 leuart1txbl leuart1txbl 0b0010 leuart1txempty leuart1txempty sourcesel = 0b010100 (i2c0) 0b0000 i2c0rxdatav i2c0rxdatav 0b0001 i2c0txbl i2c0txbl sourcesel = 0b010101 (i2c1) 0b0000 i2c1rxdatav i2c1rxdatav 0b0001 i2c1txbl i2c1txbl sourcesel = 0b011000 (timer0) 0b0000 timer0ufof timer0ufof 0b0001 timer0cc0 timer0cc0 0b0010 timer0cc1 timer0cc1 0b0011 timer0cc2 timer0cc2 sourcesel = 0b011001 (timer1) 0b0000 timer1ufof timer1ufof 0b0001 timer1cc0 timer1cc0 0b0010 timer1cc1 timer1cc1 0b0011 timer1cc2 timer1cc2 sourcesel = 0b011010 (timer2) 0b0000 timer2ufof timer2ufof 0b0001 timer2cc0 timer2cc0 0b0010 timer2cc1 timer2cc1 0b0011 timer2cc2 timer2cc2 sourcesel = 0b011011 (timer3) 0b0000 timer3ufof timer3ufof 0b0001 timer3cc0 timer3cc0 0b0010 timer3cc1 timer3cc1 0b0011 timer3cc2 timer3cc2 sourcesel = 0b101100 (uart0) 0b0000 uart0rxdatav uart0rxdatav req/sreq 0b0001 uart0txbl uart0txbl req/sreq 0b0010 uart0txempty uart0txempty
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 97 www.energymicro.com bit name reset access description value mode description sourcesel = 0b101101 (uart1) 0b0000 uart1rxdatav uart1rxdatav req/sreq 0b0001 uart1txbl uart1txbl req/sreq 0b0010 uart1txempty uart1txempty sourcesel = 0b110000 (msc) 0b0000 mscwdata mscwdata sourcesel = 0b110001 (aes) 0b0000 aesdatawr aesdatawr 0b0001 aesxordatawr aesxordatawr 0b0010 aesdatard aesdatard 0b0011 aeskeywr aeskeywr sourcesel = 0b110010 (lesense) 0b0000 lesensebufdatav lesensebufdatav req/sreq sourcesel = 0b110011 (ebi) 0b0000 ebipxl0empty ebipxl0empty 0b0001 ebipxl1empty ebipxl1empty 0b0010 ebipxlfull ebipxlfull 0b0011 ebiddempty ebiddempty
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 98 www.energymicro.com 9 rmu - reset management unit 0 1 2 3 4 sysresetreq watchdog brownout poweron reset managem ent unit reset lockup resetn quick facts what? the rmu ensures correct reset operation. it is responsible for connecting the different reset sources to the reset lines of the EFM32WG. why? a correct reset sequence is needed to ensure safe and synchronous startup of the EFM32WG. in the case of error situations such as power supply glitches or software crash, the rmu provides proper reset and startup of the EFM32WG. how? the power-on reset and brown-out detector of the EFM32WG provides power line monitoring with exceptionally low power consumption. the cause of the reset may be read from a register, thus providing software with information about the cause of the reset. 9.1 introduction the rmu is responsible for handling the reset functionality of the EFM32WG. 9.2 features ? reset sources ? power-on reset (por) ? brown-out detection (bod) on the following power domains: ? regulated domain ? unregulated domain ? analog power domain 0 (avdd0) ? analog power domain 1 (avdd1) ? resetn pin reset ? watchdog reset ? em4 wakeup reset from pin ? em4 wakeup reset from backup rtc interrupt ? wakeup from backup mode ? software triggered reset (sysresetreq) ? core lockup condition ? em4 detection ? a software readable register indicates the cause of the last reset 9.3 functional description the rmu monitors each of the reset sources of the EFM32WG. if one or more reset sources go active, the rmu applies reset to the EFM32WG. when the reset sources go inactive the EFM32WG starts
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 99 www.energymicro.com up. at startup the EFM32WG loads the stack pointer and program entry point from memory, and starts execution. as seen in figure 9.1 (p. 99 ) the power-on reset, brown-out detectors, watchdog timeout and resetn pin all reset the whole system including the debug interface. a core lockup condition or a system reset request from software resets the whole system except the debug interface. whenever a reset source is active, the corresponding bit in the rmu_rstcause register is set. at startup the program code may investigate this register in order to determine the cause of the reset. the register must be cleared by software. figure 9.1. rmu reset input sources and connections. sysreqrst wdog reset managem ent unit poresetn sysresetn lockup poweronn brownout_unregn resetn filt er lockuprdis v dd por bod core debug int erface cort ex peripherals v dd _ regulated rmu_rstcause brownout_regn rcclr edge-t o-pulse filt er bod avdd0 brownout_avdd0 bod avdd1 brownout_avdd1 bod em4 wakeup em 4 backup m ode backup m ode exit 9.3.1 rmu_rstcause register the rmu_rstcause register indicates the reason for the last reset. the register should be cleared after the value has been read at startup. otherwise the register may indicate multiple causes for the reset at next startup. the following procedure must be done to clear rmu_rstcause: 1. write a 1 to rcclr in rmu_cmd 2. write a 1 to bit 0 in emu_auxctrl 3. write a 0 to bit 0 in emu_auxctrl rmu_rstcause should be interpreted according to table 9.1 (p. 100 ) . x bits are don't care. notice that it is possible to have multiple reset causes. for example, an external reset and a watchdog reset may happen simultaneously.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 100 www.energymicro.com table 9.1. rmu reset cause register interpretation register value cause 0bxxxx xxxx xxxx xxx1 a power-on reset has been performed. x bits are don't care. 0bxxxx xxxx 0xxx xx10 a brown-out has been detected on the unregulated power. 0bxxxx xxxx xxx0 0100 a brown-out has been detected on the regulated power. 0bxxxx xxxx xxxx 1x00 an external reset has been applied. 0bxxxx xxxx xxx1 xx00 a watchdog reset has occurred. 0bxxxx x000 0010 0000 a lockup reset has occurred. 0bxxxx x000 01x0 0000 a system request reset has occurred. 0bxxxx x000 1xx0 0xx0 the system as woken up from em4. 0bxxxx x001 1xx0 0xx0 the system as woken up from em4 on an em4 wakeup reset request from pin. 0bxxxx x010 xxx0 0000 a brown-out has been detected on analog power domain 0 (avdd0). 0bxxxx x100 xxx0 0000 a brown-out has been detected on analog power domain 1 (avdd1). 0bxxxx 1xxx xxxx 0xx0 a brown-out has been detected by the backup bod on vdd_dreg. 0bxxx1 xxxx xxxx 0xx0 a brown-out has been detected by the backup bod on bu_vin. 0bxx1x xxxx xxxx 0xx0 a brown-out has been detected by the backup bod on unregulated power 0bx1xx xxxx xxxx 0xx0 a brown-out has been detected by the backup bod on regulated power. 0b1xxx xxxx xxxx 0xx0 the system has been in backup mode. note when exiting em4 with external reset, both the bodregrst and bodunregrst in rstcause might be set (i.e. are invalid) 9.3.2 power-on reset (por) the por ensures that the EFM32WG does not start up before the supply voltage v dd has reached the threshold voltage vporthr (see device datasheet electrical characteristics for details). before the threshold voltage is reached, the EFM32WG is kept in reset state. the operation of the por is illustrated in figure 9.2 (p. 100 ) , with the active low poweronn reset signal. the reason for the ?unknown? region is that the corresponding supply voltage is too low for any reliable operation. figure 9.2. rmu power-on reset operation poweronn v dd t im e v unknown vport hr 9.3.3 brown-out detector reset (bod) the EFM32WG has 4 brownout detectors, one for the unregulated 3.0 v power, one for the regulated internal power, one for analog power domain 0 (avdd0), and one for analog power domain 1 (avdd1).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 101 www.energymicro.com the bods are constantly monitoring the voltages. whenever the unregulated or regulated power drops below the vbodthr value (see electrical characteristics for details), or if the avdd0 or avdd1 drops below the voltage at the decouple pin (dec), the corresponding active low brownoutn line is held low. the bods also include hysteresis, which prevents instability in the corresponding brownoutn line when the supply is crossing the vbodthr limit or the avdd bods drops below decouple pin (dec). the operation of the bod is illustrated in figure 9.3 (p. 101 ) . the ?unknown? regions are handled by the por module. figure 9.3. rmu brown-out detector operation unknown brownoutn v dd t im e v unknown vbodt hr vbodhyst vbodhyst 9.3.4 resetn pin reset forcing the resetn pin low generates a reset of the EFM32WG. the resetn pin includes an on- chip pull-up resistor, and can therefore be left unconnected if no external reset source is needed. also connected to the resetn line is a filter which prevents glitches from resetting the EFM32WG. 9.3.5 watchdog reset the watchdog circuit is a timer which (when enabled) must be cleared by software regularly. if software does not clear it, a watchdog reset is activated. this functionality provides recovery from a software stalemate. refer to the watchdog section for specifications and description. 9.3.6 lockup reset a cortex-m4 lockup is the result of the core being locked up because of an unrecoverable exception following the activation of the processor?s built-in system state protection hardware. for more information about the cortex-m4 lockup conditions see the armv7-m architecture reference manual. the lockup reset does not reset the debug interface. set the lockuprdis bit in the rmu_ctrl register in order to disable this reset source. 9.3.7 system reset request software may initiate a reset (e.g. if it finds itself in a non-recoverable state). by asserting the sysresetreq in the application interrupt and reset control register (write 0x05fa 0004), a reset is issued. the sysresetreq does not reset the debug interface. 9.3.8 em4 reset whenever em4 is entered, the em4rst bit is set. this bit enables the user to identify that the device has been in em4. upon wake-up this bit should be cleared by software. 9.3.9 em4 wakeup reset whenever the system is woken up from em4 on a pin wake-up request, the em4wurst bit is set. this bit enables the user to identify that the device was woken up from em4 using a pin wake-up request. upon wake-up this bit should be cleared by software.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 102 www.energymicro.com 9.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 rmu_ctrl rw control register 0x004 rmu_rstcause r reset cause register 0x008 rmu_cmd w1 command register 9.5 register description 9.5.1 rmu_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 0 access rw rw name bursten lockuprdis bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 bursten 1 rw backup domain reset enable this bit has to be cleared before accessing the registers in the burtc. 0 lockuprdis 0 rw lockup reset disable set this bit to disable the lockup signal (from the cortex) from resetting the device. 9.5.2 rmu_rstcause - reset cause register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access r r r r r r r r r r r r r r r r name bumoderst bubodreg bubodunreg bubodbuvin bubodvdddreg bodavdd1 bodavdd0 em4wurst em4rst sysreqrst lockuprst wdogrst extrst bodregrst bodunregrst porst bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 bumoderst 0 r backup mode reset set if the system has been in backup mode. must be cleared by software. please see section 10.3.4 (p. 111 ) for details on how to interpret this bit. 14 bubodreg 0 r backup brown out detector regulated domain set if the backup bod sensing on regulated power triggers. must be cleared by software. please see section 10.3.4.2 (p. 112 ) for details on how to interpret this bit. 13 bubodunreg 0 r backup brown out detector unregulated domain
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 103 www.energymicro.com bit name reset access description set if the backup bod sensing on unregulated power triggers. must be cleared by software. please see section 10.3.4.2 (p. 112 ) for details on how to interpret this bit. 12 bubodbuvin 0 r backup brown out detector, bu_vin set if the backup bod sensing on bu_vin triggers. must be cleared by software. please see section 10.3.4.2 (p. 112 ) for details on how to interpret this bit. 11 bubodvdddreg 0 r backup brown out detector, vdd_dreg set if the backup bod sensing on vddd_reg triggers. must be cleared by software. please see section 10.3.4.2 (p. 112 ) for details on how to interpret this bit. 10 bodavdd1 0 r avdd1 bod reset set if analog power domain 1 brown out detector reset has been performed. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 9 bodavdd0 0 r avdd0 bod reset set if analog power domain 0 brown out detector reset has been performed. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 8 em4wurst 0 r em4 wake-up reset set if the system has been woken up from em4 from a reset request from pin. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 7 em4rst 0 r em4 reset set if the system has been in em4. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 6 sysreqrst 0 r system request reset set if a system request reset has been performed. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 5 lockuprst 0 r lockup reset set if a lockup reset has been requested. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 4 wdogrst 0 r watchdog reset set if a watchdog reset has been performed. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 3 extrst 0 r external pin reset set if an external pin reset has been performed. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 2 bodregrst 0 r brown out detector regulated domain reset set if a regulated domain brown out detector reset has been performed. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 1 bodunregrst 0 r brown out detector unregulated domain reset set if a unregulated domain brown out detector reset has been performed. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 0 porst 0 r power on reset set if a power on reset has been performed. must be cleared by software. please see table 9.1 (p. 100 ) for details on how to interpret this bit. 9.5.3 rmu_cmd - command register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name rcclr
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 104 www.energymicro.com bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 rcclr 0 w1 reset cause clear set this bit to clear the lockuprst and sysreqrst bits in the rmu_rstcause register. use the hrcclr bit in the emu_auxctrl register to clear the remaining bits.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 105 www.energymicro.com 10 emu - energy management unit 0 1 2 3 4 quick facts what? the emu (energy management unit) handles the different low energy modes in the EFM32WG microcontrollers. why? the need for performance and peripheral functions varies over time in most applications. by efficiently scaling the available resources in real-time to match the demands of the application, the energy consumption can be kept at a minimum. how? with a broad selection of energy modes, a high number of low-energy peripherals available even in em2, and short wake- up time (2 s from em2 and em3), applications can dynamically minimize energy consumption during program execution. 10.1 introduction the energy management unit (emu) manages all the low energy modes (em) in EFM32WG microcontrollers. each energy mode manages if the cpu and the various peripherals are available. the energy modes range from em0 to em4, where em0, also called run mode, enables the cpu and all peripherals. the lowest recoverable energy mode, em3, disables the cpu and most peripherals while maintaining wake-up and ram functionality. em4 disables everything except the por, pin reset and optionally backup rtc, 512 byte data retention, gpio state retention, and em4 reset wakeup request. the various energy modes differ in: ? energy consumption ? cpu activity ? reaction time ? wake-up triggers ? active peripherals ? available clock sources low energy modes em1 to em4 are enabled through the application software. in em1-em3, a range of wake-up triggers return the microcontroller back to em0. em4 can only return to em0 by power on reset, external pin reset, em4 gpio wakeup request, or backup rtc interrupt. 10.2 features ? energy mode control from software ? flexible wakeup from low energy modes ? low wakeup time
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 106 www.energymicro.com 10.3 functional description the energy management unit (emu) is responsible for managing the wide range of energy modes available in EFM32WG. an overview of the emu module is shown in figure 10.1 (p. 106 ) . figure 10.1. emu overview peripheral bus cont rol and st at us regist ers energy managem ent st at e machine cort ex volt age regulat or syst em oscillat or syst em reset syst em mem ory syst em int errupt cont roller the emu is available as a peripheral on the peripheral bus. the energy management state machine is triggered from the cortex-m4 and controls the internal voltage regulators, oscillators, memories and interrupt systems in the low energy modes. events from the interrupt or reset systems can in turn cause the energy management state machine to return to its active state. this is further described in the following sections. 10.3.1 energy modes there are five main energy modes available in EFM32WG, called energy mode 0 (em0) through energy mode 4 (em4). em0, also called the active mode, is the energy mode in which any peripheral function can be enabled and the cortex-m4 core is executing instructions. em1 through em4, also called low energy modes, provide a selection of reduced peripheral functionality that also lead to reduced energy consumption, as described below. figure 10.2 (p. 107 ) shows the transitions between different energy modes. after reset the emu will always start in em0. a transition from em0 to another energy mode is always initiated by software. em0 is the highest activity mode, in which all functionality is available. em0 is therefore also the mode with highest energy consumption. the low energy modes em1 through em4 result in less functionality being available, and therefore also reduced energy consumption. the cortex-m4 is not executing instructions in any low energy mode. each low energy mode provides different energy consumptions associated with it, for example because a different set of peripherals are enabled or because these peripherals are configured differently. a transition from em0 to a low energy mode can only be triggered by software. a transition from em1 ? em3 to em0 can be triggered by an enabled interrupt or event. in addition, a chip reset will return the device to em0. a transition from em4 can be triggered by a pin reset, power- on reset, em4 gpio wakeup, or backup rtc interrupt.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 107 www.energymicro.com figure 10.2. emu energy mode transitions em0 em1 em2 soft ware t riggered sleep int errupt t riggered wakeup reduced energy consum pt ion em3 low energy m odes act ive m ode em4 pin reset , power -on reset , em 4 wakeup, burtc int errupt no direct transitions between em1, em2 or em3 are available, as can also be seen from figure 10.2 (p. 107 ) . instead, a wakeup will transition back to em0, in which software can enter any other low energy mode. an overview of the supported energy modes and the functionality available in each mode is shown in table 10.1 (p. 108 ) . most peripheral functionality indicated as "on" in a particular energy mode can also be turned off from software in order to save further energy.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 108 www.energymicro.com table 10.1. emu energy mode overview em0 1 em1 2 em2 2 em3 2 em4 2 wakeup time to em0 - - 2 s 2 s 160 s mcu clock tree on - - - - high frequency peripheral clock trees on on - - - core voltage regulator on on - - - high frequency oscillator on on - - - i 2 c full functionality on on - - - low frequency peripheral clock trees on on on - - low frequency oscillator on on on - - real time counter on on on on 3 - lcd on on on - - leuart on on on - - letimer on on on on 3 - lesense on on on on 3 - pcnt on on on on - acmp on on on on - i 2 c receive address recognition on on on on - watchdog on on on on 3 - pin interrupts on on on on - ram voltage regulator/ram retention on on on on - brown out reset on on on on - power on reset on on on on on pin reset on on on on on gpio state retention on on on on on 4 em4 reset wakeup request - - - - on 4 backup rtc on on on on on backup retention registers on on on on on 1 energy mode 0/active mode 2 energy mode 1/2/3/4 3 when the 1 khz ulfrco is selected 4 not available in backup mode the different energy modes are summarized in the following sections. 10.3.1.1 em0 ? the high frequency oscillator is active ? high frequency clock trees are active ? all peripheral functionality is available 10.3.1.2 em1 ? the high frequency oscillator is active
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 109 www.energymicro.com ? mcu clock tree is inactive ? high frequency peripheral clock trees are active ? all peripheral functionality is available 10.3.1.3 em2 ? the high frequency oscillator is inactive ? the high frequency peripheral and mcu clock trees are inactive ? the low frequency oscillator and clock trees are active ? low frequency peripheral functionality (rtc, watchdog, lcd, leuart, i 2 c, letimer, pcnt , lesense , burtc ) is available ? wakeup through peripheral interrupt or asynchronous pin interrupt ? ram and register values are preserved ? dac and opamps are available 10.3.1.4 em3 ? both high and low frequency oscillators and clock trees are inactive ? wakeup through asynchronous pin interrupts, i 2 c address recognition or acmp edge interrupt ? watchdog, letimer and lesense enabled when ulfrco (1 khz clock) has been selected ? burtc is available. ? all other peripheral functionality is disabled ? ram and register values are preserved ? dac and opamps are available 10.3.1.5 em4 ? all oscillators and regulators are inactive, if backup rtc is not enabled. ? ram and register values are not preserved, except for the ones located in the backup rtc. ? optional gpio state retention ? wakeup from backup rtc interrupt, external pin reset or pins that support em4 wakeup 10.3.2 entering a low energy mode a low energy mode is entered by first configuring the desired energy mode through the emu_ctrl register and the sleepdeep bit in the cortex-m4 system control register, see table 10.2 (p. 110 ) . a wait for interrupt (wfi) or wait for event (wfe) instruction from the cortex-m4 triggers the transition into a low energy mode. the transition into a low energy mode can optionally be delayed until the lowest priority interrupt service routine (isr) is exited, if the sleeponexit bit in the cortex-m4 system control register is set. entering the lowest energy mode, em4, is done by writing a sequence to the em4ctrl bitfield in the emu_ctrl register. writing a zero to the em4ctrl bitfield will restart the power sequence. em2block prevents the emu to enter em2 or lower, and it will instead enter em1. em3 is equal to em2, except that the lfaclk/lfbclk are disabled in em3. the lfaclk/lfbclk must be disabled by the user before entering low energy mode. the emvreg bit in emu_ctrl can be used to prevent the voltage regulator from being turned off in low energy modes. the device will then essentially stay in em1 when entering a low energy mode.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 110 www.energymicro.com table 10.2. emu entering a low energy mode low energy mode em4ctrl emvreg em2block sleepdeep cortex-m4 instruction em1 0 x x 0 wfi or wfe em2 0 0 0 1 wfi or wfe em4 write sequence: 2, 3, 2, 3, 2, 3, 2, 3, 2 x x x x (?x? means don?t care) 10.3.3 leaving a low energy mode in each low energy mode a selection of peripheral units are available, and software can either enable or disable the functionality. enabled interrupts that can cause wakeup from a low energy mode are shown in table 10.3 (p. 111 ) . the wakeup triggers always return the efm32 to em0. additionally, any reset source will return to em0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 111 www.energymicro.com table 10.3. emu wakeup triggers from low energy modes peripheral wakeup trigger em0 1 em1 2 em2 2 em3 2 em4 2 rtc any enabled interrupt - yes yes yes 3 - usart receive / transmit - yes - - - uart receive / transmit - yes - - - leuart receive / transmit - yes yes - - lesense any enabled interrupt - yes yes yes 3 - i 2 c any enabled interrupt - yes - - - i 2 c receive address recognition - yes yes yes - timer any enabled interrupt - yes - - - letimer any enabled interrupt - yes yes yes 3 - cmu any enabled interrupt - yes - - - dma any enabled interrupt - yes - - - msc any enabled interrupt - yes - - - dac any enabled interrupt - yes - - - adc any enabled interrupt - yes - - - aes any enabled interrupt - yes - - - pcnt any enabled interrupt - yes yes yes 4 - lcd any enabled interrupt - yes yes - - acmp any enabled edge interrupt - yes yes yes - vcmp any enabled edge interrupt - yes yes yes - pin interrupts asynchronous - yes yes yes - pin reset - yes yes yes yes em4 wakeup on supported pins asynchronous - - - - yes backup rtc any enabled interrupt yes yes yes yes yes power cycle off/on yes yes yes yes 1 energy mode 0/active mode 2 energy mode 1/2/3/4 3 when the 1 khz ulfrco is selected 4 when using an external clock 10.3.4 backup power domain 10.3.4.1 introduction the EFM32WG has the possibility to be partly powered by a backup battery. the backup power input, bu_vin, is connected to a power domain in the EFM32WG containing the backup rtc and 512 bytes of data retention, available in all energy modes. figure 10.3 (p. 112 ) shows an overview of the backup powering scheme. during normal operation, the entire chip is powered by the main power supply. if the main power supply drains out and the backup mode functionality is enabled, the system enters a low energy mode, equivalent to em4, and automatically switches over to the backup power supply.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 112 www.energymicro.com figure 10.3. backup power domain overview efm32 main dom ain backup dom ain burtc bod wdog por ext em4 pin wake-up burtc wake -up reset wake-up cont roller sw reset 512 byt e ret ent ion main power ok bu_vin main power backup power main power bod resetn bu_stat bu_vout buctrl_en pwrconf_voutxxx buctrl_staten vdd_dreg pwrconf_pwrres buinact_pwrcon / buact_pwrcon + - + - main power supply backup power supply strong medium weak bubodvdddreg bubodbuvin backup regulat or bubodunreg bubodreg when in backup mode, available functionality is the same as the functionality available in em4. refer to section 10.3.4.10 (p. 115 ) for further details. 10.3.4.2 brown out detectors the backup power domain functionality utilizes four brown-out detectors, bods. one senses the main power supply, one senses the backup power supply, one senses the unregulated selected power supply (main or backup, depending on mode), and one bod senses the regulated power supply. the bits bubodvdddreg ,bubodbuvin, bubodunreg, and bubodreg in the rstcause register in the rmu are set when the associated bod triggers. the locations of the backup bods are indicated in figure 10.3 (p. 112 ) . a brown out on the main power supply will trigger a switch to the backup power supply if the backup functionality is enabled and the bod sensing on the backup power supply has not triggered. the two other bods are used for error indication and will only set the bits in rmu_rstcause if they are triggered. a reset from backup mode on bubodunreg brown-out can also be triggered if bumodeboden in emu_buctrl is set. this will cause the device to switch back to the main power supply regardless of whether this is valid or not. set this bit to make sure the device always asssume a known condition when the backup voltage drops below the operating limits. 10.3.4.3 entering backup mode to be able to enter backup mode, the en bit in emu_buctrl has to be set. the burdy interrupt flag will be set as soon as the backup sensing module is operational. status of the backup functionality is also available in the burdy flag in the emu_status register. the bu_vin pin also needs to be enabled. this is done by setting the buvinpen bit in emu_route. to enter backup mode, the voltage on vdd_dreg has to drop below the programmable threshold of the bod sensing on this power. this threshold is programmed using buenrange and buenthres in emu_buinact. buenrange
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 113 www.energymicro.com decides the voltage range for the bod, while buenthres is used for tuning of the bod threshold. refer to section 10.3.4.5 (p. 113 ) for details regarding bod calibration. note buvinpen in emu_route is by default set. if backup mode is not to be used, this bit should be cleared. note the voltage on bu_vin has to be above the threshold for the bod sensing on bu_vin to enter backup mode. the bu_stat pin can be used to indicate whether or not the system is in backup mode. to enable exporting of the backup mode status, set staten in emu_buctrl. the bu_stat pin is driven to bu_vin when backup mode is active and to ground otherwise. 10.3.4.4 leaving backup mode to exit backup mode, the voltage on vdd_dreg has to be above the threshold programmed in emu_buact. buexrange decides the voltage range for backup mode exit, while buexthres is used for tuning. when leaving backup mode, a system reset is triggered, resetting everything except the backup domain. when backup mode has been active, the burst bit in emu_rstcause is set. figure 10.4. entering and leaving backup mode emu_buact_buexrange / emu _buact_buexthres vddreg tim e backup m ode act ive emu_buinact_buenrange / emu _buinact_buenthres figure 10.4 (p. 113 ) illustrates how the bod sensing on vdd_dreg can be programmed to implement hysteresis on entering and exiting backup mode. 10.3.4.5 threshold calibration the thresholds for entering and exiting backup mode are configured in the emu_buinact and emu_buact registers, respectively. calibration of these thresholds is performed during production test, but may also be performed using the dac. the calibration values for the bods sensing on unregulated power and bu_vin, bubodunreg and bubodbuvin respectively, are available in emu_bubodvincal and emu_bubodunregcal. these registers are written during production test and should not be modified except for calibrating the backup bod sensing on vdd_dreg, as described in the following section. setting bodcal in emu_buctrl will enable a mode where the bod is sensing the dac output, as depicted in figure 10.5 (p. 114 ) . for the bodcal bit to take effect, the backup power enable bit, en in emu_buctrl, has to be cleared. the procedure for bod calibration is as follows: ? clear en and set bodcal in emu_buctrl. ? store the values in emu_bubodvincal and emu_bubodunregcal before clearing these registers. ? configure the dac to output to the maximum level and wait for 500 us before configuring the dac output to the wanted bod trigger voltage level. ? step through the bod calibration values (range and thres in emu_buinact) with 500 us delay in between steps until the bubodvdddreg flag in rmu_rstcause is set. the range and thres
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 114 www.energymicro.com values in emu_buinact can now be written to emu_buinact for configuration of threshold for entering backup mode, or emu_buact for configuration of the threshold for leaving backup mode. ? restore the values in emu_bubodvincal and emu_bubodunregcal. figure 10.5. bod calibration using dac 1.8v + - buctrl_bodcal dac alt ernat ive out put vdd_dreg bod t rigger 0 1 emu_buinact_buenrange / emu _buinact_buenthres 10.3.4.6 backup battery charging the EFM32WG includes functionality for charging of the backup battery. this is done by connecting the main power and the backup power through a resistor, and optionally a diode. the connection is configured individually for when in backup mode and when in normal mode. when in normal mode, the connection is configured in pwrcon in emu_buinact. pwrcon in emu_buact configures the connection when in backup mode. the series resistance between the two power domains is configured in pwrres in emu_pwrconf, this configuration applies both to backup mode and normal mode. 10.3.4.7 supply voltage output to be able to power external devices, the supply voltage for the backup domain is available as an output. three switches connect the backup supply voltage to the bu_vout pin. to be able to control the series resistance, the switches have different strengths: weak, medium, and strong. the switches are controlled using the voutweak, voutmed, and voutstrong bits in emu_pwrconf. for resistor values, refer to device datasheet electrical characteristics. 10.3.4.8 voltage probing it is possible to probe the voltage levels at vdd_dreg, bu_vin, and bu_vout. this is done by configuring the adc to measure a tristated channel, for instance a disabled dac channel. the probe bitfield in emu_buctrl configures which voltage to be probed. the voltage measured by the adc will be 1/8 of the actual probed voltage, meaning that the result needs to be multiplied by 8 for the correct result. voltage probing does not work when bodcal in the emu_buctrl register is set. 10.3.4.9 configuration lock configurations used in backup mode and em4, like bod calibration, and backup rtc settings need to be locked before entering em4, this is done by setting the lockconf bit in emu_em4conf. this bit should also be set before a potential entry to backup mode. setting this bit will lock following the configuration: ? lfxomode, lfxobufcur, and lfxoboost in cmu_ctrl ? redlfxoboost in emu_auxctrl ? tuning in cmu_lfrcoctrl ? bursten in rmu_ctrl ? burtcwu and vregen in emu_em4conf ? emu_buctrl ? emu_pwrconf ? emu_buinact ? emu_buact
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 115 www.energymicro.com ? emu_route note for registers residing in the cmu and emu_auxctrl, the reset value will be read after exit from em4 or backup mode, but if lockconf in emu_em4conf has been set, the locked configuration will be used until lockconf is cleared. this also applies for the lockconf bit itself. 10.3.4.10 em4 with rtc and data retention the backup power domain can also be powered by the main power. this provides possibility for backup rtc operation and data retention in em4. available functionality in em4 is configured in emu_em4conf. setting the vregen bit will keep the voltage regulator for the backup domain enabled when in em4. this allows the backup rtc to keep running. to enable the backup rtc to wake up the system from em4, burtcwu in emu_em4conf needs to be set. when burtcwu is set, any enabled backup rtc interrupt will wake up the system. for further details regarding the backup rtc and em4 data retention, refer to chapter 22 (p. 565 ) . 10.3.4.10.1 oscillators in em4 when the system is in em4 or backup mode with the voltage regulator enabled, the ulfrco is by default enabled. if the lfxo or lfrco is used by the backup rtc, the ulfrco can be shut down to reduce power consumption. to do this, configure the osc bitfield in emu_em4conf. note if osc in emu_em4conf is not set to ulfrco, presc and lpcomp in burtc_ctrl has to be configured in the following manner: ? 4 < (presc + lpcomp) < 8, presc = 0,5,6,7 refer to chapter 22 (p. 565 ) for details on how to configure the backup rtc. 10.3.4.10.2 brown-out detector in em4 to enable brown-out detection in em4, the backup bods have to be enabled, by setting en in emu_buctrl. when burdy in emu_status is set, the brown-out detectors are ready and able to issue a reset from em4 if a brown-out is detected on either regulated or unregulated power. the backup bod' ability to issue reset from em4 can be disabled by setting bubodrstdis in emu_em4conf. note the backup bods can be enabled without allowing entrance to backup mode. this is done by setting en in emu_buctrl, and clearing buvinpen in emu_route.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 116 www.energymicro.com 10.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 emu_ctrl rw control register 0x008 emu_lock rw configuration lock register 0x024 emu_auxctrl rw auxiliary control register 0x02c emu_em4conf rw energy mode 4 configuration register 0x030 emu_buctrl rw backup power configuration register 0x034 emu_pwrconf rw power connection configuration register 0x038 emu_buinact rw backup mode inactive configuration register 0x03c emu_buact rw backup mode active configuration register 0x040 emu_status r status register 0x044 emu_route rw i/o routing register 0x048 emu_if r interrupt flag register 0x04c emu_ifs w1 interrupt flag set register 0x050 emu_ifc w1 interrupt flag clear register 0x054 emu_ien rw interrupt enable register 0x058 emu_bubodbuvincal rw bu_vin backup bod calibration 0x05c emu_bubodunregcal rw unregulated power backup bod calibration 10.5 register description 10.5.1 emu_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 access rw rw rw name em4ctrl em2block emvreg bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:2 em4ctrl 0x0 rw energy mode 4 control this register is used to enter energy mode 4, in which the device only wakes up from an external pin reset, from a power cycle, backup rtc interrupt, or em4 wakeup reset request. energy mode 4 is entered when the em4 sequence is written to this bitfield. 1 em2block 0 rw energy mode 2 block this bit is used to prevent the mcu to enter energy mode 2 or lower. 0 emvreg 0 rw energy mode voltage regulator control control the voltage regulator in low energy modes 2 and 3. value mode description 0 reduced reduced voltage regulator drive strength in em2 and em3. 1 full full voltage regulator drive strength in em2 and em3.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 117 www.energymicro.com 10.5.2 emu_lock - configuration lock register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name lockkey bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 lockkey 0x0000 rw configuration lock key write any other value than the unlock code to lock all emu registers, except the interrupt registers, from editing. write the unlock code to unlock. when reading the register, bit 0 is set when the lock is enabled. mode value description read operation unlocked 0 emu registers are unlocked. locked 1 emu registers are locked. write operation lock 0 lock emu registers. unlock 0xade8 unlock emu registers. 10.5.3 emu_auxctrl - auxiliary control register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access rw rw name redlfxoboost hrcclr bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 redlfxoboost 0 rw reduce lfxo start-up boost current set this bit to reduce start-up boost current for lfxo. 7:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 hrcclr 0 rw hard reset cause clear write to 1 and then 0 to clear the por, bod and wdog reset cause register bits. see also the reset management unit (rmu).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 118 www.energymicro.com 10.5.4 emu_em4conf - energy mode 4 configuration register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x0 0 0 access rw rw rw rw rw name lockconf bubodrstdis osc burtcwu vregen bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 lockconf 0 rw em4 configuration lock enable lock regulator, bod and oscillator configuration. this is necessary before going to em4 if the regulator is to be used in em4, and must also be done before a potential entry to backup mode. 15:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 bubodrstdis 0 rw disable reset from backup bod in em4 when set, no reset will be asserted due to brownout when in em4. 3:2 osc 0x0 rw select em4 duty oscillator value mode description 0 ulfrco ulfrco is available. 1 lfrco lfrco is available. can only be set if lfrco is running before em4/backup entry. 2 lfxo lfxo is available. can only be set if lfxo is available before em4/backup entry. 1 burtcwu 0 rw backup rtc em4 wakeup enable exit em4 on backup rtc interrupt. 0 vregen 0 rw em4 voltage regulator enable when set, the voltage regulator is enabled in em4, enabling operation of the backup rtc and retention registers. 10.5.5 emu_buctrl - backup power configuration register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 access rw rw rw rw rw name probe bumodeboden bodcal staten en bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:5 probe 0x0 rw voltage probe select configure which voltage to export to adc.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 119 www.energymicro.com bit name reset access description value mode description 0 disable disable voltage probe. 1 vdddreg connect probe to vdd_dreg. 2 buin connect probe to bu_in. 3 buout connect probe to bu_out. 4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 bumodeboden 0 rw enable brown out detection on bu_vin when in backup mode when set, a reset (and switch back to main power) will be performed when in backup mode and bu_vin browns out. 2 bodcal 0 rw enable bod calibration mode when set, the backup bod sensing on vdd_dreg will be sensing the dac output. 1 staten 0 rw enable backup mode status export when enabled, bu_stat will indicate when backup mode is active. 0 en 0 rw enable backup mode backup mode will be entered when main power browns out and backup battery is present. 10.5.6 emu_pwrconf - power connection configuration register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 access rw rw rw rw name pwrres voutstrong voutmed voutweak bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4:3 pwrres 0x0 rw power domain resistor select select value of series resistor between main power domain and backup power domain. value mode description 0 res0 main power and backup power connected with res0 series resistance. 1 res1 main power and backup power connected with res1 series resistance. 2 res2 main power and backup power connected with res2 series resistance. 3 res3 main power and backup power connected with res3 series resistance. 2 voutstrong 0 rw bu_vout strong enable enable strong switch between backup domain power supply and bu_vout. 1 voutmed 0 rw bu_vout medium enable enable medium switch between backup domain power supply and bu_vout. 0 voutweak 0 rw bu_vout weak enable enable weak switch between backup domain power supply and bu_vout.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 120 www.energymicro.com 10.5.7 emu_buinact - backup mode inactive configuration register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 access rw rw rw name pwrcon buenrange buenthres bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:5 pwrcon 0x0 rw power connection configuration when not in backup mode value mode description 0 none no connection. 1 bumain main power and backup power are connected through a diode, allowing current to flow from backup power source to main power source, but not the other way. 2 mainbu main power and backup power are connected through a diode, allowing current to flow from main power source to backup power source, but not the other way. 3 nodiode main power and backup power are connected without diode. 4:3 buenrange 0x0 rw threshold range for backup bod sensing on vdd_dreg when not in backup mode. 2:0 buenthres 0x0 rw threshold for backup bod sensing on vdd_dreg when not in backup mode. 10.5.8 emu_buact - backup mode active configuration register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 access rw rw rw name pwrcon buexrange buexthres bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:5 pwrcon 0x0 rw power connection configuration when in backup mode value mode description 0 none no connection. 1 bumain main power and backup power are connected through a diode, allowing current to flow from backup power source to main power source, but not the other way. 2 mainbu main power and backup power are connected through a diode, allowing current to flow from main power source to backup power source, but not the other way. 3 nodiode main power and backup power are connected without diode. 4:3 buexrange 0x0 rw
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 121 www.energymicro.com bit name reset access description threshold range for backup bod sensing on vdd_dreg when in backup mode. 2:0 buexthres 0x0 rw threshold for backup bod sensing on vdd_dreg when in backup mode. 10.5.9 emu_status - status register offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access r name burdy bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 burdy 0 r backup mode ready set when the backup power functionality is ready. 10.5.10 emu_route - i/o routing register offset bit position 0x044 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 access rw name buvinpen bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 buvinpen 1 rw bu_vin pin enable when set, the bu_vin pin is enabled. 10.5.11 emu_if - interrupt flag register offset bit position 0x048 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access r name burdy
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 122 www.energymicro.com bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 burdy 0 r backup functionality ready interrupt flag set when the backup functionality is ready for use. 10.5.12 emu_ifs - interrupt flag set register offset bit position 0x04c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name burdy bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 burdy 0 w1 set backup functionality ready interrupt flag write to 1 to set the burdy interrupt flag. 10.5.13 emu_ifc - interrupt flag clear register offset bit position 0x050 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name burdy bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 burdy 0 w1 clear backup functionality ready interrupt flag write to 1 to clear the burdy interrupt flag. 10.5.14 emu_ien - interrupt enable register offset bit position 0x054 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name burdy
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 123 www.energymicro.com bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 burdy 0 rw backup functionality ready interrupt enable enable interrupt when backup functionality is ready. 10.5.15 emu_bubodbuvincal - bu_vin backup bod calibration offset bit position 0x058 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 access rw rw name range thres bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4:3 range 0x0 rw threshold range for backup bod sensing on bu_vin. 2:0 thres 0x0 rw threshold for backup bod sensing on bu_vin. 10.5.16 emu_bubodunregcal - unregulated power backup bod calibration offset bit position 0x05c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 access rw rw name range thres bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4:3 range 0x0 rw threshold range for backup bod sensing on unregulated power. 2:0 thres 0x0 rw threshold for backup bod sensing on unregulated power.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 124 www.energymicro.com 11 cmu - clock management unit 0 1 2 3 4 oscillat ors cmu wdog clock letimer clock lcd clock peripheral a clock peripheral b clock peripheral c clock peripheral d clock cpu clock quick facts what? the cmu controls oscillators and clocks. EFM32WG supports five different oscillators with minimized power consumption and short start-up time. an additional separate rc oscillator is used for flash programming and debug trace. the cmu also has hw support for calibration of rc oscillators. why? oscillators and clocks contribute significantly to the power consumption of the mcu. with the low power oscillators combined with the flexible clock control scheme, it is possible to minimize the energy consumption in any given application. how? the cmu can configure different clock sources, enable/disable clocks to peripherals on an individual basis and set the prescaler for the different clocks. the short oscillator start-up times makes duty-cycling between active mode and the different low energy modes (em2-4) very efficient. the calibration feature ensures high accuracy rc oscillators. several interrupts are available to avoid cpu polling of flags. 11.1 introduction the clock management unit (cmu) is responsible for controlling the oscillators and clocks on-board the EFM32WG. the cmu provides the capability to turn on and off the clock on an individual basis to all peripheral modules in addition to enable/disable and configure the available oscillators. the high degree of flexibility enables software to minimize energy consumption in any specific application by not wasting power on peripherals and oscillators that are inactive. 11.2 features ? multiple clock sources available: ? 1-28 mhz high frequency rc oscillator (hfrco) ? 4-48 high frequency crystal oscillator (hfxo) ? 32.768 khz low frequency rc oscillator (lfrco) ? 1 khz ultra low frequency rc oscillator (ulfrco) ? 32.768 khz low frequency crystal oscillator (lfxo) ? low power oscillators ? low start-up times ? separate prescaler for high frequency core clocks (hfcoreclk) and peripheral clocks (hfperclk) ? individual clock prescaler selection for each low energy peripheral
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 125 www.energymicro.com ? clock gating on an individual basis to core modules and all peripherals ? selectable clocks can be output on two pins for use externally. ? auxiliary 1-28 mhz rc oscillator (auxhfrco) for flash programming, debug trace, and lesense timing. 11.3 functional description an overview of the cmu is shown in figure 11.1 (p. 126 ) . the number of peripheral modules that are connected to the different clocks varies from device to device.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 126 www.energymicro.com figure 11.1. cmu overview hfxo hfrco lfxo lfrco prescaler cmu_hf per clken0 . i2c0 hfperclk timer 1 tim eout tim eout tim eout tim eout cmu_lfaclken0.rtc hfperclk i 2 c 0 cmu_hf per clken0 . timer0 hfperclk timer 0 hfcoreclk cm 4 cmu_hfperclkdiv . hfperclken cmu_hf per clken0 . timer 1 hfclk clock gat e clock gat e prescaler em0 hfcoreclk dma cmu_hfcoreclken0 . dma clock gat e lfaclk rtc cmu_lfaclken0. le timer0 clock gat e lfaclk letimer 0 cmu_lfaclken0. l cd clock gat e lfaclk l cd lfaclk cmu_lfbclken0. leuart 0 clock gat e lfbclk leuart 0 clock gat e lfbclk leuart 1 lfbclk clock gat e clock gat e clock gat e clock swit ch clock swit ch clock swit ch prescaler prescaler prescaler prescaler prescaler hfcoreclk le cmu_hfc ore clken0 . le clock gat e . . . . . . /2 or / 4 hfcoreclk hfperclk fram e rat e cont rol . . . ulfrco pcntnclk pcntn_s0 wdog wdog_ctrl.clksel cmu_lfclksel.lfb / lfbe cmu_lfclksel.lfa / lfae cmu_lfbclken0. leuart 1 cmu_lcdctrl.fdiv cmu_hfperclkdiv . hfperclk div cmu_hf core clkdiv cmu_lfbpresc0. leuart 1 cmu_lfbpresc0. leuart 0 cmu_lfapresc0.lcd cmu_lfapresc0.letimer0 cmu_lfapresc0.rtc cmu_pcntctrl. pcnt n clksel lfaclk l cdpre auxhfrco debug trace msc ( flash program m ing) tim eout auxclk wdogclk cmu_ cmd . hfclksel . . . clock swit ch cmu_ctrl_dbgclk cmu_lfaclken0.lesense clock gat e lfaclk lesense prescaler cmu_lfapresc0.lesense lesense ( high frequency t im ing) hfclk div cmu_ ctrl . hfclk div clock swit ch cmu_cmd.usbcclksel hfcoreclk usbc cmu_hfcoreclken0 . usbc burtc 11.3.1 system clocks 11.3.1.1 hfclk - high frequency clock hfclk is the selected high frequency clock. this clock is used by the cmu and drives the two prescalers that generate hfcoreclk and hfperclk. the hfclk can be driven by a high-frequency oscillator (hfrco or hfxo) or one of the low-frequency oscillators (lfrco or lfxo). by default the
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 127 www.energymicro.com hfrco is selected. in most applications, one of the high frequency oscillators will be the preferred choice. to change the selected hfclk write to hfclksel in cmu_cmd. the hfclk is running in em0 and em1. hfclk can optionally be divided down by setting hfclkdiv in cmu_ctrl to a nonzero value. this divides down hfclk to all high frequency components except the usb core and is typically used to save energy in usb applications where the system is not required to run at 48 mhz. combined with the hfcoreclk and hfperclk prescalers the hfclk divider also allows for more flexible clock division. 11.3.1.2 hfcoreclk - high frequency core clock hfcoreclk is a prescaled version of hfclk. this clock drives the core modules, which consists of the cpu and modules that are tightly coupled to the cpu, e.g. msc, dma etc. this also includes the interface to the low energy peripherals. some of the modules that are driven by this clock can be clock gated completely when not in use. this is done by clearing the clock enable bit for the specific module in cmu_hfcoreclken0. the frequency of hfcoreclk is set using the cmu_hfcoreclkdiv register. the setting can be changed dynamically and the new setting takes effect immediately. the usb core clock (usbc) is always undivided regardless of the hfclkdiv setting. when the usb core is active this clock must be switched to a 32 khz clock (lfrco or lfxo) when entering em2. the usb core uses this clock for monitoring the usb bus. the switch is done by writing usbcclksel in cmu_cmd. the currently active clock can be checked by reading cmu_status. the clock switch can take up to 1.5 32 khz cycle (45 us). to avoid polling the clock selection status when switching switching from 32 khz to hfclk when coming up from em2 the usbchfclksel interrupt can be used. em3 is not supported when the usb is active. note note that if hfperclk runs faster than hfcoreclk, the number of clock cycles for each bus-access to peripheral modules will increase with the ratio between the clocks. please refer to section 5.2.3.2 (p. 21 ) for more details. 11.3.1.3 hfperclk - high frequency peripheral clock like hfcoreclk, hfperclk can also be a prescaled version of hfclk. this clock drives the high-frequency peripherals. all the peripherals that are driven by this clock can be clock gated completely when not in use. this is done by clearing the clock enable bit for the specific peripheral in cmu_hfperclken0. the frequency of hfperclk is set using the cmu_hfperclkdiv register. the setting can be changed dynamically and the new setting takes effect immediately. note note that if hfperclk runs faster than hfcoreclk, the number of clock cycles for each bus-access to peripheral modules will increase with the ratio between the clocks. e.g. if a bus-access normally takes three cycles, it will take 9 cycles if hfperclk runs three times as fast as the hfcoreclk. 11.3.1.4 lfaclk - low frequency a clock lfaclk is the selected clock for the low energy a peripherals. there are four selectable sources for lfaclk: lfrco, lfxo, hfcoreclk/2 and ulfrco. in addition, the lfaclk can be disabled. from reset, the lfaclk source is set to lfrco. however, note that the lfrco is disabled from reset. the selection is configured using the lfa field in cmu_lfclksel. the hfcoreclk/2 setting allows the low energy a peripherals to be used as high-frequency peripherals. note if hfcoreclk/2 is selected as lfaclk, the clock will stop in em2/3.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 128 www.energymicro.com each low energy peripheral that is clocked by lfaclk has its own prescaler setting and enable bit. the prescaler settings are configured using cmu_lfapresc0 and the clock enable bits can be found in cmu_lfaclken0. notice that the lcd has an additional high resolution prescaler for frame rate control, configured by fdiv in cmu_lcdctrl. when operating in oversampling mode, the pulse counters are clocked by lfaclk. this is configured for each pulse counter (n) individually by setting pcntnclksel in cmu_pcntctrl. 11.3.1.5 lfbclk - low frequency b clock lfbclk is the selected clock for the low energy b peripherals. there are four selectable sources for lfbclk: lfrco, lfxo, hfcoreclk/2 and ulfrco. in addition, the lfbclk can be disabled. from reset, the lfbclk source is set to lfrco. however, note that the lfrco is disabled from reset. the selection is configured using the lfb field in cmu_lfclksel. the hfcoreclk/2 setting allows the low energy b peripherals to be used as high-frequency peripherals. note if hfcoreclk/2 is selected as lfbclk, the clock will stop in em2/3. each low energy peripheral that is clocked by lfbclk has its own prescaler setting and enable bit. the prescaler settings are configured using cmu_lfbpresc0 and the clock enable bits can be found in cmu_lfbclken0. 11.3.1.6 pcntnclk - pulse counter n clock each available pulse counter is driven by its own clock, pcntnclk where n is the pulse counter instance number. each pulse counter can be configured to use an external pin (pcntn_s0) or lfaclk as pcntnclk. 11.3.1.7 wdogclk - watchdog timer clock the watchdog timer (wdog) can be configured to use one of three different clock sources: lfrco, lfxo or ulfrco. ulfrco (ultra low frequency rc oscillator) is a separate 1 khz rc oscillator that also runs in em3. 11.3.1.8 auxclk - auxiliary clock auxclk is a 1-28 mhz clock driven by a separate rc oscillator, auxhfrco. this clock is used for flash programming, and serial wire output (swo), and lesense operation. during flash programming, or if needed by lesense, this clock will be active. if the auxhfrco has not been enabled explicitly by software, the msc or lesense module will automatically start and stop it. the auxhfrco is enabled by writing a 1 to auxhfrcoen in cmu_oscencmd. this explicit enabling is required when swo is used. 11.3.2 oscillator selection 11.3.2.1 start-up time the different oscillators have different start-up times. for the rc oscillators, the start-up time is fixed, but both the lfxo and the hfxo have configurable start-up time. at the end of the start-up time a ready flag is set to indicated that the start-up time has exceeded and that the clock is available. the low start- up time values can be used for an external clock source of already high quality, while the higher start-up times should be used when the clock signal is coming directly from a crystal. the startup time for hfxo and lfxo can be set by configuring the hfxotimeout and lfxotimeout bitfields, respectively. both bitfields are located in cmu_ctrl. for hfxo it is also possible to enable a glitch detection filter by setting hfxoglitchdeten in cmu_ctrl. the glitch detector will reset the start-up counter if a glitch is detected, making the start-up process start over again.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 129 www.energymicro.com there are individual bits for each oscillator indicating the status of the oscillator: ? enabled - indicates that the oscillator is enabled ? ready - start-up time is exceeded ? selected - start-up time is exceeded and oscillator is chosen as clock source these status bits are located in the cmu_status register. 11.3.2.2 switching clock source the hfrco oscillator is a low energy oscillator with extremely short wake-up time. therefore, this oscillator is always chosen by hardware as the clock source for hfclk when the device starts up (e.g. after reset and after waking up from em2 and em3). after reset, the hfrco frequency is 14 mhz. software can switch between the different clock sources at run-time. e.g., when the hfrco is the clock source, software can switch to hfxo by writing the field hfclksel in the cmu_cmd command register. see figure 11.2 (p. 129 ) for a description of the sequence of events for this specific operation. note it is important first to enable the hfxo since switching to a disabled oscillator will effectively stop hfclk and only a reset can recover the system. during the start-up period hfclk will stop since the oscillator driving it is not ready. this effectively stalls the core modules and the high-frequency peripherals. it is possible to avoid this by first enabling the hfxo and then wait for the oscillator to become ready before switching the clock source. this way, the system continues to run on the hfrco until the hfxo has timed out and provides a reliable clock. this sequence of events is shown in figure 11.3 (p. 130 ) . a separate flag is set when the oscillator is ready. this flag can also be configured to generate an interrupt. figure 11.2. cmu switching from hfrco to hfxo before hfxo is ready hfxo cmu_status.. hfxordy cmu_status. hfxoens cmu_status. hfxosel hfrco hfclk hfxo t im e-out period cmu_status. hfrcordy cmu_status. hfrcoens cmu_status. hfrcosel cmu_oscencmd. hfxoen cmu_oscencmd. hfxodis clocks cmu_cmd. hfclksel cmu_oscencmd. hfrcoen cmu_oscencmd. hfrcodis com m and st at us 00 02 00
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 130 www.energymicro.com figure 11.3. cmu switching from hfrco to hfxo after hfxo is ready 00 02 00 hfxo cmu_status. hfxordy cmu_status. hfxoens cmu_status. hfxosel hfrco hfclk hfxo t im e-out period cmu_status. hfrcordy cmu_status. hfrcoens cmu_status. hfrcosel cmu_oscencmd. hfxoen cmu_oscencmd. hfxodis clocks cmu_cmd. hfclksel cmu_oscencmd. hfrcoen cmu_oscencmd. hfrcodis com m and st at us switching clock source for lfaclk and lfbclk is done by setting the lfa and lfb fields in cmu_lfclksel. to ensure no stalls in the low energy peripherals, the clock source should be ready before switching to it. note to save energy, remember to turn off all oscillators not in use. 11.3.3 oscillator configuration 11.3.3.1 hfxo and lfxo the crystal oscillators are by default configured to ensure safe startup and operation of the most common crystals. in order to optimize startup margin, startup time and power consumption for a given crystal, it is possible to adjust the gain in the oscillator. hfxo gain can be increased by setting hfxoboost field in cmu_ctrl, lfxo gain can be increased by setting lfxoboost field in cmu_ctrl or reduced by setting redlfxoboost field in emu_auxctrl. it is important that the boost settings, along with the crystal load capacitors are matched to the crystals in use. correct values for these parameters can be found using the energyaware designer. the hfxo crystal is connected to the hfxtal_n/hfxtal_p pins as shown in figure 11.4 (p. 130 ) figure 11.4. hfxo pin connection efm32 hfxtal_n hfxtal_p 4-48 mhz c l 1 c l 2
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 131 www.energymicro.com similarly, the lfxo crystal is connected to the lfxtal_n/lfxtal_p pins as shown in figure 11.5 (p. 131 ) figure 11.5. lfxo pin connection efm32 lfxtal_n lfxtal_p 32.768khz c l 1 c l 2 it is possible to connect an external clock source to hfxtal_n/lfxtal_n pin of the hfxo or lfxo oscillator. by configuring the hfxomode/lfxomode fields in cmu_ctrl, the hfxo/lfxo can be bypassed. 11.3.3.2 hfrco, lfrco and auxhfrco it is possible to calibrate the hfrco, lfrco and auxhfrco to achieve higher accuracy (see the device datasheets for details on accuracy). the frequency is adjusted by changing the tuning fields in cmu_hfrcoctrl/cmu_lfrcoctrl/cmu_auxhfrcoctrl. changing to a higher value will result in a higher frequency. please refer to the datasheet for stepsize details. the hfrco and auxhfrco can be set to one of several different frequency bands from 1 mhz to 28 mhz by setting the band field in cmu_hfrcoctrl and cmu_auxhfrcoctrl.the hfrco and auxhfrco frequency bands are calibrated during production test, and the production tested calibration values can be read from the device information (di) page. the di page contains a separate tuning value for each frequency band. during reset, hfrco and auxhfrco tuning values are set to the production calibrated values for the 14 mhz band, which is the default frequency band. when changing to a different hfrco or auxhfrco band, make sure to also update the tuning value. the lfrco and is also calibrated in production and its tuning value is set to the correct value during reset. the cmu has built-in hw support to efficiently calibrate the rc oscillators at run-time, see figure 11.6 (p. 132 ) the concept is to select a reference and compare the rc frequency with the reference frequency. when the calibration circuit is started, one down-counter running on a selectable clock (downsel in cmu_calctrl) and one up-counter running on a selectable clock (upsel in cmu_calctrl) are started simultaneously. the top value for the down-counter must be written to cmu_calcnt before calibration is started. when the down-counter has reached 0, the up-counter is sampled and the calrdy interrupt flag is set. if cont in cmu_calctrl is cleared, the counters are stopped at this point. if continuous mode is selected by setting cont in cmu_calctrl the down-counter reloads the top value and continues counting and the up-counter restarts from 0. software can then read out the sampled up-counter value from cmu_calcnt. then it is easy to find the ratio between the reference and the oscillator subject to the calibration. overflows of the up-counter will not occur. if the up-counter reaches its top value before the down counter reaches 0, the top counter stays at its top value. calibration can be stopped by writing calstop in cmu_cmd. with this hw support, it is simple to write efficient calibration algorithms in software.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 132 www.energymicro.com figure 11.6. hw-support for rc oscillator calibration cmu _ calctrl . refsel auxhfrco hfrco lfrco hfxo lfxo 20-bit up-count er cmu _ calctrl . downsel auxhfrco hfrco lfrco hfxo lfxo top writ e t op-value using cmu _calcnt before st art ing calibrat ion . downclk dom ain upclk dom ain hfclk dom ain = 0 ? sync (default ) hfclk sync 20-bit up-count er buffer sync 20-bit down-count er set cmu_if.calrdy cmu_calcnt downclk upclk reload down-count er wit h t op value in cont inouous m ode . take snapshot of up-count er in up -count er bufffer. if in cont inouous m ode , rest art up -count er from 0. the counter operation for single and continuous mode are shown in figure 11.7 (p. 132 ) and figure 11.8 (p. 132 ) respectively. figure 11.7. single calibration (cont=0) top 0 calibrat ion st art ed calibrat ion st opped ( count ers st opped) 0 down-count er up-count er up-count er sam pled and calrdy int errupt flag set . sam pled value available in cmu _calcnt. figure 11.8. continuous calibration (cont=1) top 0 calibrat ion st art ed 0 down-count er up-count er up-count er sam pled and calrdy int errupt flag set . sam pled value available in cmu _calcnt. up-count er sam pled and calrdy int errupt flag set . sam pled value available in cmu _calcnt.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 133 www.energymicro.com 11.3.4 configuration for operating frequencies the hfxo is capable of driving crystals up to 48 mhz, which allows the efm32 to run at up to this frequency. different frequencies have different requirements as shown in table 11.1 (p. 133 ) . before going to a high frequency, make sure the registers in the table have the correct values. when going down in frequency, make sure to keep the registers at the values required by the higher frequency until after the switch has been done. table 11.1. configuration for operating frequencies maximum frequency mode in msc_readctrl hfle in cmu_ctrl hfxobufcur in cmu_ctrl 16 mhz ws0 / ws0scbtp / ws1 / ws1scbtp / ws2 / ws2scbtp - boostupto32mhz (default value) 32 mhz ws1 / ws1scbtp / ws2 / ws2scbtp - boostupto32mhz (default value) 48 mhz ws2 / ws2scbtp 1 boostabove32mhz mode in msc_readctrl makes sure the flash is able to operate at the given frequencies by inserting waitstates for flash accesses. hfxobufcur in cmu_ctrl should be set to boostabove32mhz when operating above 32 mhz. when operating at 32 mhz or below, the default value (boostupto32mhz) should be used. hfle in cmu_ctrl is only required for frequencies above 32 mhz, and ensures correct operation of le peripherals. this register also implies hfcoreclklediv in cmu_hfcoreclkdiv set to div4, reducing the frequency of cmu_hfcoreclklediv2. 11.3.5 output clock on a pin it is possible to configure the cmu to output clocks on two pins. this clock selection is done using clkoutsel0 and clkoutsel1 fields in cmu_ctrl. the output pins must be configured in the cmu_route register. ? lfrco, lfxo, hfclk or the qualified clock from any of the oscillators can be output on one pin (cmu_out1). a qualified clock will not have any glitches or skewed duty-cycle during startup. for lfxo and hfxo you need to configure lfxotimeout and hfxotimeout in cmu_ctrl correctly to guarantee a qualified clock. ? hfrco, hfxo, hfclk/2, hfclk/4, hfclk/8, hfclk/16, ulfrco or auxhfrco can be output on another pin (cmu_out0) note that hfxo and hfrco clock outputs to pin can be unstable after startup and should not be output on a pin before hfxordy/hfrcordy is set high in cmu_status. 11.3.6 protection it is possible to lock the control- and command registers to prevent unintended software writes to critical clock settings. this is controlled by the cmu_lock register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 134 www.energymicro.com 11.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 cmu_ctrl rw cmu control register 0x004 cmu_hfcoreclkdiv rw high frequency core clock division register 0x008 cmu_hfperclkdiv rw high frequency peripheral clock division register 0x00c cmu_hfrcoctrl rw hfrco control register 0x010 cmu_lfrcoctrl rw lfrco control register 0x014 cmu_auxhfrcoctrl rw auxhfrco control register 0x018 cmu_calctrl rw calibration control register 0x01c cmu_calcnt rwh calibration counter register 0x020 cmu_oscencmd w1 oscillator enable/disable command register 0x024 cmu_cmd w1 command register 0x028 cmu_lfclksel rw low frequency clock select register 0x02c cmu_status r status register 0x030 cmu_if r interrupt flag register 0x034 cmu_ifs w1 interrupt flag set register 0x038 cmu_ifc w1 interrupt flag clear register 0x03c cmu_ien rw interrupt enable register 0x040 cmu_hfcoreclken0 rw high frequency core clock enable register 0 0x044 cmu_hfperclken0 rw high frequency peripheral clock enable register 0 0x050 cmu_syncbusy r synchronization busy register 0x054 cmu_freeze rw freeze register 0x058 cmu_lfaclken0 rw low frequency a clock enable register 0 (async reg) 0x060 cmu_lfbclken0 rw low frequency b clock enable register 0 (async reg) 0x068 cmu_lfapresc0 rw low frequency a prescaler register 0 (async reg) 0x070 cmu_lfbpresc0 rw low frequency b prescaler register 0 (async reg) 0x078 cmu_pcntctrl rw pcnt control register 0x07c cmu_lcdctrl rw lcd control register 0x080 cmu_route rw i/o routing register 0x084 cmu_lock rw configuration lock register
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 135 www.energymicro.com 11.5 register description 11.5.1 cmu_ctrl - cmu control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x0 0x0 0x3 0 0x0 1 0x0 0x3 0 0x1 0x3 0x0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw name hfle dbgclk clkoutsel1 clkoutsel0 lfxotimeout lfxobufcur hfclkdiv lfxoboost lfxomode hfxotimeout hfxoglitchdeten hfxobufcur hfxoboost hfxomode bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30 hfle 0 rw high-frequency le interface set to allow access to le peripherals when running at frequencies higher than 32 mhz. 29 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 28 dbgclk 0 rw debug clock select clock used for the debug system. value mode description 0 auxhfrco auxhfrco is the debug clock. 1 hfclk the system clock is the debug clock. 27:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:23 clkoutsel1 0x0 rw clock output select 1 controls the clock output multiplexer. to actually output on the pin, set clkout1pen in cmu_route. value mode description 0 lfrco lfrco (directly from oscillator). 1 lfxo lfxo (directly from oscillator). 2 hfclk hfclk. 3 lfxoq lfxo (qualified). 4 hfxoq hfxo (qualified). 5 lfrcoq lfrco (qualified). 6 hfrcoq hfrco (qualified). 7 auxhfrcoq auxhfrco (qualified). 22:20 clkoutsel0 0x0 rw clock output select 0 controls the clock output multiplexer. to actually output on the pin, set clkout0pen in cmu_route. value mode description 0 hfrco hfrco (directly from oscillator). 1 hfxo hfxo (directly from oscillator). 2 hfclk2 hfclk/2. 3 hfclk4 hfclk/4. 4 hfclk8 hfclk/8. 5 hfclk16 hfclk/16. 6 ulfrco ulfrco (directly from oscillator). 7 auxhfrco auxhfrco (directly from oscillator). 19:18 lfxotimeout 0x3 rw lfxo timeout configures the start-up delay for lfxo.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 136 www.energymicro.com bit name reset access description value mode description 0 8cycles timeout period of 8 cycles. 1 1kcycles timeout period of 1024 cycles. 2 16kcycles timeout period of 16384 cycles. 3 32kcycles timeout period of 32768 cycles. 17 lfxobufcur 0 rw lfxo boost buffer current this value has been set during calibration and should not be changed. 16:14 hfclkdiv 0x0 rw hfclk division use to divide hfclk frequency by (hfclkdiv + 1). 13 lfxoboost 1 rw lfxo start-up boost current adjusts start-up boost current for lfxo. value mode description 0 70pcent 70 %. 1 100pcent 100 % (default). 12:11 lfxomode 0x0 rw lfxo mode set this to configure the external source for the lfxo. the oscillator setting takes effect when 1 is written to lfxoen in cmu_oscencmd. the oscillator setting is reset to default when 1 is written to lfxodis in cmu_oscencmd. value mode description 0 xtal 32.768 khz crystal oscillator. 1 bufextclk an ac coupled buffer is coupled in series with lfxtal_n pin, suitable for external sinus wave (32.768 khz). 2 digextclk digital external clock on lfxtal_n pin. oscillator is effectively bypassed. 10:9 hfxotimeout 0x3 rw hfxo timeout configures the start-up delay for hfxo. value mode description 0 8cycles timeout period of 8 cycles. 1 256cycles timeout period of 256 cycles. 2 1kcycles timeout period of 1024 cycles. 3 16kcycles timeout period of 16384 cycles. 8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 hfxoglitchdeten 0 rw hfxo glitch detector enable this bit enables the glitch detector which is active as long as the start-up ripple-counter is counting. a detected glitch will reset the ripple-counter effectively increasing the start-up time. once the ripple-counter has timed-out, glitches will not be detected. 6:5 hfxobufcur 0x1 rw hfxo boost buffer current the current level in the hfxo buffer should be set to default value when operating on 32 mhz or below. when operating on frequencies above 32 mhz, the buffer current level should be set to 3. value mode description 1 boostupto32mhz boost buffer current level when hfxo is below or equal to 32 mhz. 3 boostabove32mhz boost buffer current level when hfxo is above 32 mhz. 4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:2 hfxoboost 0x3 rw hfxo start-up boost current used to adjust start-up boost current for hfxo. value mode description 0 50pcent 50 %. 1 70pcent 70 %. 2 80pcent 80 %. 3 100pcent 100 % (default). 1:0 hfxomode 0x0 rw hfxo mode
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 137 www.energymicro.com bit name reset access description set this to configure the external source for the hfxo. the oscillator setting takes effect when 1 is written to hfxoen in cmu_oscencmd. the oscillator setting is reset to default when 1 is written to hfxodis in cmu_oscencmd. value mode description 0 xtal 4-32 mhz crystal oscillator. 1 bufextclk an ac coupled buffer is coupled in series with hfxtal_n, suitable for external sine wave (4-32 mhz). the sine wave should have a minimum of 200 mv peak to peak. 2 digextclk digital external clock on hfxtal_n pin. oscillator is effectively bypassed. 11.5.2 cmu_hfcoreclkdiv - high frequency core clock division register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 access rw rw name hfcoreclklediv hfcoreclkdiv bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 hfcoreclklediv 0 rw additional division factor for hfcoreclkle additional division factor for hfcoreclkle. when running at frequencies higher than 24 mhz, this must be set to div4. value mode description 0 div2 valid for frequencies 24 mhz and lower. 1 div4 must be used when hfcoreclk may go above 24 mhz. 7:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 hfcoreclkdiv 0x0 rw hfcoreclk divider specifies the clock divider for hfcoreclk. value mode description 0 hfclk hfcoreclk = hfclk. 1 hfclk2 hfcoreclk = hfclk/2. 2 hfclk4 hfcoreclk = hfclk/4. 3 hfclk8 hfcoreclk = hfclk/8. 4 hfclk16 hfcoreclk = hfclk/16. 5 hfclk32 hfcoreclk = hfclk/32. 6 hfclk64 hfcoreclk = hfclk/64. 7 hfclk128 hfcoreclk = hfclk/128. 8 hfclk256 hfcoreclk = hfclk/256. 9 hfclk512 hfcoreclk = hfclk/512.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 138 www.energymicro.com 11.5.3 cmu_hfperclkdiv - high frequency peripheral clock division register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 0x0 access rw rw name hfperclken hfperclkdiv bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 hfperclken 1 rw hfperclk enable set to enable the hfperclk. 7:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 hfperclkdiv 0x0 rw hfperclk divider specifies the clock divider for the hfperclk. value mode description 0 hfclk hfperclk = hfclk. 1 hfclk2 hfperclk = hfclk/2. 2 hfclk4 hfperclk = hfclk/4. 3 hfclk8 hfperclk = hfclk/8. 4 hfclk16 hfperclk = hfclk/16. 5 hfclk32 hfperclk = hfclk/32. 6 hfclk64 hfperclk = hfclk/64. 7 hfclk128 hfperclk = hfclk/128. 8 hfclk256 hfperclk = hfclk/256. 9 hfclk512 hfperclk = hfclk/512. 11.5.4 cmu_hfrcoctrl - hfrco control register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x3 0x80 access rw rw rw name sudelay band tuning bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16:12 sudelay 0x00 rw hfrco start-up delay always write this field to 0. 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 139 www.energymicro.com bit name reset access description 10:8 band 0x3 rw hfrco band select write this field to set the frequency band in which the hfrco is to operate. when changing this setting there will be no glitches on the hfrco output, hence it is safe to change this setting even while the system is running on the hfrco. to ensure an accurate frequency, the hftuning value should also be written when changing the frequency band. the calibrated tuning value for the different bands can be read from the device information page. value mode description 0 1mhz 1 mhz. note: also set the tuning value (bits 7:0) when changing band. 1 7mhz 7 mhz. note: also set the tuning value (bits 7:0) when changing band. 2 11mhz 11 mhz. note: also set the tuning value (bits 7:0) when changing band. 3 14mhz 14 mhz. note: also set the tuning value (bits 7:0) when changing band. 4 21mhz 21 mhz. note: also set the tuning value (bits 7:0) when changing band. 5 28mhz 28 mhz. note: also set the tuning value (bits 7:0) when changing band. 7:0 tuning 0x80 rw hfrco tuning value writing this field adjusts the hfrco frequency (the higher value, the higher frequency). this field is updated with the production calibrated value for the 14 mhz band during reset, and the reset value might therefore vary between devices. 11.5.5 cmu_lfrcoctrl - lfrco control register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x40 access rw name tuning bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:0 tuning 0x40 rw lfrco tuning value writing this field adjusts the lfrco frequency (the higher value, the higher frequency). this field is updated with the production calibrated value during reset, and the reset value might therefore vary between devices. 11.5.6 cmu_auxhfrcoctrl - auxhfrco control register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x80 access rw rw name band tuning bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 140 www.energymicro.com bit name reset access description 10:8 band 0x0 rw auxhfrco band select write this field to set the frequency band in which the auxhfrco is to operate. when changing this setting there will be no glitches on the hfrco output, hence it is safe to change this setting even while the system is using the auxhfrco. to ensure an accurate frequency, the auxtuning value should also be written when changing the frequency band. the calibrated tuning value for the different bands can be read from the device information page. flash erase and write use this clock. if it is changed to another value than the default, msc_timebase must also be configured to ensure correct flash erase and write operation. value mode description 0 14mhz 14 mhz. note: also set the tuning value (bits 7:0) when changing band. 1 11mhz 11 mhz. note: also set the tuning value (bits 7:0) when changing band. 2 7mhz 7 mhz. note: also set the tuning value (bits 7:0) when changing band. 3 1mhz 1 mhz. note: also set the tuning value (bits 7:0) when changing band. 6 28mhz 28 mhz. note: also set the tuning value (bits 7:0) when changing band. 7 21mhz 21 mhz. note: also set the tuning value (bits 7:0) when changing band. 7:0 tuning 0x80 rw auxhfrco tuning value this value has been set during calibration and should not be changed. 11.5.7 cmu_calctrl - calibration control register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 0x0 access rw rw rw name cont downsel upsel bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 cont 0 rw continuous calibration set this bit to enable continuous calibration. 5:3 downsel 0x0 rw calibration down-counter select selects clock source for the calibration down-counter. value mode description 0 hfclk select hfclk for down-counter. 1 hfxo select hfxo for down-counter. 2 lfxo select lfxo for down-counter. 3 hfrco select hfrco for down-counter. 4 lfrco select lfrco for down-counter. 5 auxhfrco select auxhfrco for down-counter. 2:0 upsel 0x0 rw calibration up-counter select selects clock source for the calibration up-counter. value mode description 0 hfxo select hfxo as up-counter. 1 lfxo select lfxo as up-counter. 2 hfrco select hfrco as up-counter. 3 lfrco select lfrco as up-counter. 4 auxhfrco select auxhfrco as up-counter.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 141 www.energymicro.com 11.5.8 cmu_calcnt - calibration counter register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000 access rwh name calcnt bit name reset access description 31:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19:0 calcnt 0x00000 rwh calibration counter write top value before calibration. read calibration result from this register when calibration ready flag has been set. 11.5.9 cmu_oscencmd - oscillator enable/disable command register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name lfxodis lfxoen lfrcodis lfrcoen auxhfrcodis auxhfrcoen hfxodis hfxoen hfrcodis hfrcoen bit name reset access description 31:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9 lfxodis 0 w1 lfxo disable disables the lfxo. lfxoen has higher priority if written simultaneously. 8 lfxoen 0 w1 lfxo enable enables the lfxo. 7 lfrcodis 0 w1 lfrco disable disables the lfrco. lfrcoen has higher priority if written simultaneously. 6 lfrcoen 0 w1 lfrco enable enables the lfrco. 5 auxhfrcodis 0 w1 auxhfrco disable disables the auxhfrco. auxhfrcoen has higher priority if written simultaneously. warning: do not disable this clock during a flash erase/write operation. 4 auxhfrcoen 0 w1 auxhfrco enable enables the auxhfrco. 3 hfxodis 0 w1 hfxo disable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 142 www.energymicro.com bit name reset access description disables the hfxo. hfxoen has higher priority if written simultaneously. warning: do not disable the hfrxo if this oscillator is selected as the source for hfclk. 2 hfxoen 0 w1 hfxo enable enables the hfxo. 1 hfrcodis 0 w1 hfrco disable disables the hfrco. hfrcoen has higher priority if written simultaneously. warning: do not disable the hfrco if this oscillator is selected as the source for hfclk. 0 hfrcoen 0 w1 hfrco enable enables the hfrco. 11.5.10 cmu_cmd - command register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0x0 access w1 w1 w1 w1 name usbcclksel calstop calstart hfclksel bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:5 usbcclksel 0x0 w1 usb core clock select selects the clock for hfcoreclk usbc . the status register is updated when the clock switch has taken effect. value mode description 1 hfclknodiv select hfclknodiv as hfcoreclk usbc . 2 lfxo select lfxo as hfcoreclk usbc . 3 lfrco select lfrco as hfcoreclk usbc . 4 calstop 0 w1 calibration stop stops the calibration counters. 3 calstart 0 w1 calibration start starts the calibration, effectively loading the cmu_calcnt into the down-counter and start decrementing. 2:0 hfclksel 0x0 w1 hfclk select selects the clock source for hfclk. note that selecting an oscillator that is disabled will cause the system clock to stop. check the status register and confirm that oscillator is ready before switching. value mode description 1 hfrco select hfrco as hfclk. 2 hfxo select hfxo as hfclk. 3 lfrco select lfrco as hfclk. 4 lfxo select lfxo as hfclk.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 143 www.energymicro.com 11.5.11 cmu_lfclksel - low frequency clock select register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x1 0x1 access rw rw rw rw name lfbe lfae lfb lfa bit name reset access description 31:21 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 20 lfbe 0 rw clock select for lfb extended this bit redefines the meaning of the lfb field. value mode description 0 disabled lfbclk is disabled (when lfb = disabled). 1 ulfrco ulfrco selected as lfbclk (when lfb = disabled). 19:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 lfae 0 rw clock select for lfa extended this bit redefines the meaning of the lfa field. value mode description 0 disabled lfaclk is disabled (when lfa = disabled). 1 ulfrco ulfrco selected as lfaclk (when lfa = disabled). 15:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:2 lfb 0x1 rw clock select for lfb selects the clock source for lfbclk. lfb lfbe mode description 0 0 disabled lfbclk is disabled 1 0 lfrco lfrco selected as lfbclk 2 0 lfxo lfxo selected as lfbclk 3 0 hfcoreclklediv2 hfcoreclk le divided by two is selected as lfbclk 0 1 ulfrco ulfrco selected as lfbclk 1:0 lfa 0x1 rw clock select for lfa selects the clock source for lfaclk. lfa lfae mode description 0 0 disabled lfaclk is disabled 1 0 lfrco lfrco selected as lfaclk 2 0 lfxo lfxo selected as lfaclk 3 0 hfcoreclklediv2 hfcoreclk le divided by two is selected as lfaclk 0 1 ulfrco ulfrco selected as lfaclk
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 144 www.energymicro.com 11.5.12 cmu_status - status register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 access r r r r r r r r r r r r r r r r r r name usbclfrcosel usbclfxosel usbchfclksel calbsy lfxosel lfrcosel hfxosel hfrcosel lfxordy lfxoens lfrcordy lfrcoens auxhfrcordy auxhfrcoens hfxordy hfxoens hfrcordy hfrcoens bit name reset access description 31:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17 usbclfrcosel 0 r usbc lfrco selected lfrco is selected (and active) as hfcoreclk usbc . 16 usbclfxosel 0 r usbc lfxo selected lfxo is selected (and active) as hfcoreclk usbc . 15 usbchfclksel 0 r usbc hfclk selected hfclk is selected (and active) as hfcoreclk usbc . 14 calbsy 0 r calibration busy calibration is on-going. 13 lfxosel 0 r lfxo selected lfxo is selected as hfclk clock source. 12 lfrcosel 0 r lfrco selected lfrco is selected as hfclk clock source. 11 hfxosel 0 r hfxo selected hfxo is selected as hfclk clock source. 10 hfrcosel 1 r hfrco selected hfrco is selected as hfclk clock source. 9 lfxordy 0 r lfxo ready lfxo is enabled and start-up time has exceeded. 8 lfxoens 0 r lfxo enable status lfxo is enabled. 7 lfrcordy 0 r lfrco ready lfrco is enabled and start-up time has exceeded. 6 lfrcoens 0 r lfrco enable status lfrco is enabled. 5 auxhfrcordy 0 r auxhfrco ready auxhfrco is enabled and start-up time has exceeded. 4 auxhfrcoens 0 r auxhfrco enable status auxhfrco is enabled. 3 hfxordy 0 r hfxo ready hfxo is enabled and start-up time has exceeded. 2 hfxoens 0 r hfxo enable status hfxo is enabled. 1 hfrcordy 1 r hfrco ready
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 145 www.energymicro.com bit name reset access description hfrco is enabled and start-up time has exceeded. 0 hfrcoens 1 r hfrco enable status hfrco is enabled. 11.5.13 cmu_if - interrupt flag register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 1 access r r r r r r r r name usbchfclksel calof calrdy auxhfrcordy lfxordy lfrcordy hfxordy hfrcordy bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 usbchfclksel 0 r usbc hfclk selected interrupt flag set when hfclk is selected as hfcoreclk usbc . 6 calof 0 r calibration overflow interrupt flag set when calibration overflow has occurred 5 calrdy 0 r calibration ready interrupt flag set when calibration is completed. 4 auxhfrcordy 0 r auxhfrco ready interrupt flag set when auxhfrco is ready (start-up time exceeded). 3 lfxordy 0 r lfxo ready interrupt flag set when lfxo is ready (start-up time exceeded). 2 lfrcordy 0 r lfrco ready interrupt flag set when lfrco is ready (start-up time exceeded). 1 hfxordy 0 r hfxo ready interrupt flag set when hfxo is ready (start-up time exceeded). 0 hfrcordy 1 r hfrco ready interrupt flag set when hfrco is ready (start-up time exceeded). 11.5.14 cmu_ifs - interrupt flag set register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 name usbchfclksel calof calrdy auxhfrcordy lfxordy lfrcordy hfxordy hfrcordy
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 146 www.energymicro.com bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 usbchfclksel 0 w1 usbc hfclk selected interrupt flag set write to 1 to set the usbc hfclk selected interrupt flag. 6 calof 0 w1 calibration overflow interrupt flag set write to 1 to set the calibration overflow interrupt flag. 5 calrdy 0 w1 calibration ready interrupt flag set write to 1 to set the calibration ready(completed) interrupt flag. 4 auxhfrcordy 0 w1 auxhfrco ready interrupt flag set write to 1 to set the auxhfrco ready interrupt flag. 3 lfxordy 0 w1 lfxo ready interrupt flag set write to 1 to set the lfxo ready interrupt flag. 2 lfrcordy 0 w1 lfrco ready interrupt flag set write to 1 to set the lfrco ready interrupt flag. 1 hfxordy 0 w1 hfxo ready interrupt flag set write to 1 to set the hfxo ready interrupt flag. 0 hfrcordy 0 w1 hfrco ready interrupt flag set write to 1 to set the hfrco ready interrupt flag. 11.5.15 cmu_ifc - interrupt flag clear register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 name usbchfclksel calof calrdy auxhfrcordy lfxordy lfrcordy hfxordy hfrcordy bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 usbchfclksel 0 w1 usbc hfclk selected interrupt flag clear write to 1 to clear the usbc hfclk selected interrupt flag. 6 calof 0 w1 calibration overflow interrupt flag clear write to 1 to clear the calibration overflow interrupt flag. 5 calrdy 0 w1 calibration ready interrupt flag clear write to 1 to clear the calibration ready interrupt flag. 4 auxhfrcordy 0 w1 auxhfrco ready interrupt flag clear write to 1 to clear the auxhfrco ready interrupt flag. 3 lfxordy 0 w1 lfxo ready interrupt flag clear write to 1 to clear the lfxo ready interrupt flag. 2 lfrcordy 0 w1 lfrco ready interrupt flag clear write to 1 to clear the lfrco ready interrupt flag. 1 hfxordy 0 w1 hfxo ready interrupt flag clear write to 1 to clear the hfxo ready interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 147 www.energymicro.com bit name reset access description 0 hfrcordy 0 w1 hfrco ready interrupt flag clear write to 1 to clear the hfrco ready interrupt flag. 11.5.16 cmu_ien - interrupt enable register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw name usbchfclksel calof calrdy auxhfrcordy lfxordy lfrcordy hfxordy hfrcordy bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 usbchfclksel 0 rw usbc hfclk selected interrupt enable set to enable the usbc hfclk selected interrupt. 6 calof 0 rw calibration overflow interrupt enable set to enable the calibration overflow interrupt. 5 calrdy 0 rw calibration ready interrupt enable set to enable the calibration ready interrupt. 4 auxhfrcordy 0 rw auxhfrco ready interrupt enable set to enable the auxhfrco ready interrupt. 3 lfxordy 0 rw lfxo ready interrupt enable set to enable the lfxo ready interrupt. 2 lfrcordy 0 rw lfrco ready interrupt enable set to enable the lfrco ready interrupt. 1 hfxordy 0 rw hfxo ready interrupt enable set to enable the hfxo ready interrupt. 0 hfrcordy 0 rw hfrco ready interrupt enable set to enable the hfrco ready interrupt. 11.5.17 cmu_hfcoreclken0 - high frequency core clock enable register 0 offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name ebi le usb usbc aes dma
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 148 www.energymicro.com bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ebi 0 rw external bus interface clock enable set to enable the clock for ebi. 4 le 0 rw low energy peripheral interface clock enable set to enable the clock for le. interface used for bus access to low energy peripherals. 3 usb 0 rw universal serial bus interface clock enable set to enable the clock for usb. 2 usbc 0 rw universal serial bus interface core clock enable set to enable the clock for usbc. 1 aes 0 rw advanced encryption standard accelerator clock enable set to enable the clock for aes. 0 dma 0 rw direct memory access controller clock enable set to enable the clock for dma. 11.5.18 cmu_hfperclken0 - high frequency peripheral clock enable register 0 offset bit position 0x044 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name dac0 adc0 prs vcmp gpio i2c1 i2c0 acmp1 acmp0 timer3 timer2 timer1 timer0 uart1 uart0 usart2 usart1 usart0 bit name reset access description 31:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17 dac0 0 rw digital to analog converter 0 clock enable set to enable the clock for dac0. 16 adc0 0 rw analog to digital converter 0 clock enable set to enable the clock for adc0. 15 prs 0 rw peripheral reflex system clock enable set to enable the clock for prs. 14 vcmp 0 rw voltage comparator clock enable set to enable the clock for vcmp. 13 gpio 0 rw general purpose input/output clock enable set to enable the clock for gpio. 12 i2c1 0 rw i2c 1 clock enable set to enable the clock for i2c1. 11 i2c0 0 rw i2c 0 clock enable set to enable the clock for i2c0. 10 acmp1 0 rw analog comparator 1 clock enable set to enable the clock for acmp1. 9 acmp0 0 rw analog comparator 0 clock enable set to enable the clock for acmp0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 149 www.energymicro.com bit name reset access description 8 timer3 0 rw timer 3 clock enable set to enable the clock for timer3. 7 timer2 0 rw timer 2 clock enable set to enable the clock for timer2. 6 timer1 0 rw timer 1 clock enable set to enable the clock for timer1. 5 timer0 0 rw timer 0 clock enable set to enable the clock for timer0. 4 uart1 0 rw universal asynchronous receiver/transmitter 0 clock enable set to enable the clock for uart1. 3 uart0 0 rw universal asynchronous receiver/transmitter 0 clock enable set to enable the clock for uart0. 2 usart2 0 rw universal synchronous/asynchronous receiver/transmitter 2 clock enable set to enable the clock for usart2. 1 usart1 0 rw universal synchronous/asynchronous receiver/transmitter 1 clock enable set to enable the clock for usart1. 0 usart0 0 rw universal synchronous/asynchronous receiver/transmitter 0 clock enable set to enable the clock for usart0. 11.5.19 cmu_syncbusy - synchronization busy register offset bit position 0x050 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access r r r r name lfbpresc0 lfbclken0 lfapresc0 lfaclken0 bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 lfbpresc0 0 r low frequency b prescaler 0 busy used to check the synchronization status of cmu_lfbpresc0. value description 1 cmu_lfbpresc0 is busy synchronizing new value. 5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 lfbclken0 0 r low frequency b clock enable 0 busy used to check the synchronization status of cmu_lfbclken0. value description 0 cmu_lfbclken0 is ready for update. 1 cmu_lfbclken0 is busy synchronizing new value. 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 lfapresc0 0 r low frequency a prescaler 0 busy
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 150 www.energymicro.com bit name reset access description used to check the synchronization status of cmu_lfapresc0. value description 0 cmu_lfapresc0 is ready for update. 1 cmu_lfapresc0 is busy synchronizing new value. 1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 lfaclken0 0 r low frequency a clock enable 0 busy used to check the synchronization status of cmu_lfaclken0. value description 0 cmu_lfaclken0 is ready for update. 1 cmu_lfaclken0 is busy synchronizing new value. 11.5.20 cmu_freeze - freeze register offset bit position 0x054 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name regfreeze bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 regfreeze 0 rw register update freeze when set, the update of the low frequency clock control registers is postponed until this bit is cleared. use this bit to update several registers simultaneously. value mode description 0 update each write access to a low frequency clock control register is updated into the low frequency domain as soon as possible. 1 freeze the le clock control registers are not updated with the new written value. 11.5.21 cmu_lfaclken0 - low frequency a clock enable register 0 (async reg) offset bit position 0x058 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access rw rw rw rw name lcd letimer0 rtc lesense bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 151 www.energymicro.com bit name reset access description 3 lcd 0 rw liquid crystal display controller clock enable set to enable the clock for lcd. 2 letimer0 0 rw low energy timer 0 clock enable set to enable the clock for letimer0. 1 rtc 0 rw real-time counter clock enable set to enable the clock for rtc. 0 lesense 0 rw low energy sensor interface clock enable set to enable the clock for lesense. 11.5.22 cmu_lfbclken0 - low frequency b clock enable register 0 (async reg) offset bit position 0x060 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access rw rw name leuart1 leuart0 bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 leuart1 0 rw low energy uart 1 clock enable set to enable the clock for leuart1. 0 leuart0 0 rw low energy uart 0 clock enable set to enable the clock for leuart0. 11.5.23 cmu_lfapresc0 - low frequency a prescaler register 0 (async reg) offset bit position 0x068 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0x0 access rw rw rw rw name lcd letimer0 rtc lesense bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:12 lcd 0x0 rw liquid crystal display controller prescaler configure liquid crystal display controller prescaler
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 152 www.energymicro.com bit name reset access description value mode description 0 div16 lfaclk lcd = lfaclk/16 1 div32 lfaclk lcd = lfaclk/32 2 div64 lfaclk lcd = lfaclk/64 3 div128 lfaclk lcd = lfaclk/128 11:8 letimer0 0x0 rw low energy timer 0 prescaler configure low energy timer 0 prescaler value mode description 0 div1 lfaclk letimer0 = lfaclk 1 div2 lfaclk letimer0 = lfaclk/2 2 div4 lfaclk letimer0 = lfaclk/4 3 div8 lfaclk letimer0 = lfaclk/8 4 div16 lfaclk letimer0 = lfaclk/16 5 div32 lfaclk letimer0 = lfaclk/32 6 div64 lfaclk letimer0 = lfaclk/64 7 div128 lfaclk letimer0 = lfaclk/128 8 div256 lfaclk letimer0 = lfaclk/256 9 div512 lfaclk letimer0 = lfaclk/512 10 div1024 lfaclk letimer0 = lfaclk/1024 11 div2048 lfaclk letimer0 = lfaclk/2048 12 div4096 lfaclk letimer0 = lfaclk/4096 13 div8192 lfaclk letimer0 = lfaclk/8192 14 div16384 lfaclk letimer0 = lfaclk/16384 15 div32768 lfaclk letimer0 = lfaclk/32768 7:4 rtc 0x0 rw real-time counter prescaler configure real-time counter prescaler value mode description 0 div1 lfaclk rtc = lfaclk 1 div2 lfaclk rtc = lfaclk/2 2 div4 lfaclk rtc = lfaclk/4 3 div8 lfaclk rtc = lfaclk/8 4 div16 lfaclk rtc = lfaclk/16 5 div32 lfaclk rtc = lfaclk/32 6 div64 lfaclk rtc = lfaclk/64 7 div128 lfaclk rtc = lfaclk/128 8 div256 lfaclk rtc = lfaclk/256 9 div512 lfaclk rtc = lfaclk/512 10 div1024 lfaclk rtc = lfaclk/1024 11 div2048 lfaclk rtc = lfaclk/2048 12 div4096 lfaclk rtc = lfaclk/4096 13 div8192 lfaclk rtc = lfaclk/8192 14 div16384 lfaclk rtc = lfaclk/16384 15 div32768 lfaclk rtc = lfaclk/32768 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 lesense 0x0 rw low energy sensor interface prescaler configure low energy sensor interface prescaler value mode description 0 div1 lfaclk lesense = lfaclk 1 div2 lfaclk lesense = lfaclk/2 2 div4 lfaclk lesense = lfaclk/4 3 div8 lfaclk lesense = lfaclk/8
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 153 www.energymicro.com 11.5.24 cmu_lfbpresc0 - low frequency b prescaler register 0 (async reg) offset bit position 0x070 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 access rw rw name leuart1 leuart0 bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:4 leuart1 0x0 rw low energy uart 1 prescaler configure low energy uart 1 prescaler value mode description 0 div1 lfbclk leuart1 = lfbclk 1 div2 lfbclk leuart1 = lfbclk/2 2 div4 lfbclk leuart1 = lfbclk/4 3 div8 lfbclk leuart1 = lfbclk/8 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 leuart0 0x0 rw low energy uart 0 prescaler configure low energy uart 0 prescaler value mode description 0 div1 lfbclk leuart0 = lfbclk 1 div2 lfbclk leuart0 = lfbclk/2 2 div4 lfbclk leuart0 = lfbclk/4 3 div8 lfbclk leuart0 = lfbclk/8 11.5.25 cmu_pcntctrl - pcnt control register offset bit position 0x078 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name pcnt2clksel pcnt2clken pcnt1clksel pcnt1clken pcnt0clksel pcnt0clken bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 pcnt2clksel 0 rw pcnt2 clock select this bit controls which clock that is used for the pcnt. value mode description 0 lfaclk lfaclk is clocking pcnt2. 1 pcnt2s0 external pin pcnt2_s0 is clocking pcnt0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 154 www.energymicro.com bit name reset access description 4 pcnt2clken 0 rw pcnt2 clock enable this bit enables/disables the clock to the pcnt. value description 0 pcnt2 is disabled. 1 pcnt2 is enabled. 3 pcnt1clksel 0 rw pcnt1 clock select this bit controls which clock that is used for the pcnt. value mode description 0 lfaclk lfaclk is clocking pcnt0. 1 pcnt1s0 external pin pcnt1_s0 is clocking pcnt0. 2 pcnt1clken 0 rw pcnt1 clock enable this bit enables/disables the clock to the pcnt. value description 0 pcnt1 is disabled. 1 pcnt1 is enabled. 1 pcnt0clksel 0 rw pcnt0 clock select this bit controls which clock that is used for the pcnt. value mode description 0 lfaclk lfaclk is clocking pcnt0. 1 pcnt0s0 external pin pcnt0_s0 is clocking pcnt0. 0 pcnt0clken 0 rw pcnt0 clock enable this bit enables/disables the clock to the pcnt. value description 0 pcnt0 is disabled. 1 pcnt0 is enabled. 11.5.26 cmu_lcdctrl - lcd control register offset bit position 0x07c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x2 0 0x0 access rw rw rw name vbfdiv vboosten fdiv bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:4 vbfdiv 0x2 rw voltage boost frequency division these bits control the voltage boost update frequency division. value mode description 0 div1 voltage boost update frequency = lfaclk. 1 div2 voltage boost update frequency = lfaclk/2. 2 div4 voltage boost update frequency = lfaclk/4. 3 div8 voltage boost update frequency = lfaclk/8. 4 div16 voltage boost update frequency = lfaclk/16. 5 div32 voltage boost update frequency = lfaclk/32.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 155 www.energymicro.com bit name reset access description value mode description 6 div64 voltage boost update frequency = lfaclk/64. 7 div128 voltage boost update frequency = lfaclk/128. 3 vboosten 0 rw voltage boost enable this bit enables/disables the vboost function. 2:0 fdiv 0x0 rw frame rate control these bits controls the framerate according to this formula: lfaclk lcd = lfaclk lcdpre / (1 + fdiv). do not change this value while the lcd bit in cmu_lfaclken0 is set to 1. 11.5.27 cmu_route - i/o routing register offset bit position 0x080 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 access rw rw rw name location clkout1pen clkout0pen bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4:2 location 0x0 rw i/o location decides the location of the cmu i/o pins. value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 1 clkout1pen 0 rw clkout1 pin enable when set, the clkout1 pin is enabled. 0 clkout0pen 0 rw clkout0 pin enable when set, the clkout0 pin is enabled. 11.5.28 cmu_lock - configuration lock register offset bit position 0x084 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name lockkey bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 156 www.energymicro.com bit name reset access description 15:0 lockkey 0x0000 rw configuration lock key write any other value than the unlock code to lock cmu_ctrl, cmu_hfcoreclkdiv, cmu_hfperclkdiv, cmu_hfrcoctrl, cmu_lfrcoctrl, cmu_auxhfrcoctrl, cmu_oscencmd, cmu_cmd, cmu_lfclksel, cmu_hfcoreclken0, cmu_hfperclken0, cmu_lfaclken0, cmu_lfbclken0, cmu_lfapresc0, cmu_lfbpresc0, and cmu_pcntctrl from editing. write the unlock code to unlock. when reading the register, bit 0 is set when the lock is enabled. mode value description read operation unlocked 0 cmu registers are unlocked. locked 1 cmu registers are locked. write operation lock 0 lock cmu registers. unlock 0x580e unlock cmu registers.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 157 www.energymicro.com 12 wdog - watchdog timer 0 1 2 3 4 tim eout period count er value tim e wat chdog clear syst em reset quick facts what? the wdog (watchdog timer) resets the system in case of a fault condition, and can be enabled in all energy modes as long as the low frequency clock source is available. why? if a software failure or external event renders the mcu unresponsive, a watchdog timeout will reset the system to a known, safe state. how? an enabled watchdog timer implements a configurable timeout period. if the cpu fails to re-start the watchdog timer before it times out, a full system reset will be triggered. the watchdog consumes insignificant power, and allows the device to remain safely in low energy modes for up to 256 seconds at a time. 12.1 introduction the purpose of the watchdog timer is to generate a reset in case of a system failure, to increase application reliability. the failure may e.g. be caused by an external event, such as an esd pulse, or by a software failure. 12.2 features ? clock input from selectable oscillators ? internal 32 khz rc oscillator ? internal 1khz rc oscillator ? external 32.768 khz xtal oscillator ? configurable timeout period from 9 to 256k watchdog clock cycles ? individual selection to keep running or freeze when entering em2 or em3 ? selection to keep running or freeze when entering debug mode ? selection to block the cpu from entering energy mode 4 ? selection to block the cmu from disabling the selected watchdog clock 12.3 functional description the watchdog is enabled by setting the en bit in wdog_ctrl. when enabled, the watchdog counts up to the period value configured through the persel field in wdog_ctrl. if the watchdog timer is not cleared to 0 (by writing a 1 to the clear bit in wdog_cmd) before the period is reached, the chip is reset. if a timely clear command is issued, the timer starts counting up from 0 again. the watchdog can optionally be locked by writing the lock bit in wdog_ctrl. once locked, it cannot be disabled or reconfigured by software. the watchdog counter is reset when en is reset.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 158 www.energymicro.com 12.3.1 clock source three clock sources are available for use with the watchdog, through the clksel field in wdog_ctrl. the corresponding clocks must be enabled in the cmu. the swoscblock bit in wdog_ctrl can be written to prevent accidental disabling of the selected clocks. also, setting this bit will automatically start the selected oscillator source when the watchdog is enabled. the persel field in wdog_ctrl is used to divide the selected watchdog clock, and the timeout for the watchdog timer can be calculated like this: wdog timeout equation t timeout = (2 3+persel + 1)/f , (12.1) where f is the frequency of the selected clock. it is recommended to clear the watchdog first, if persel is changed while the watchdog is enabled. to use this module, the le interface clock must be enabled in cmu_hfcoreclken0, in addition to the module clock. 12.3.2 debug functionality the watchdog timer can either keep running or be frozen when the device is halted by a debugger. this configuration is done through the debugrun bit in wdog_ctrl. when code execution is resumed, the watchdog will continue counting where it left off. 12.3.3 energy mode handling the watchdog timer can be configured to either keep on running or freeze when entering em2 or em3. the configuration is done individually for each energy mode in the em2run and em3run bits in wdog_ctrl. when the watchdog has been frozen and is re-entering an energy mode where it is running, the watchdog timer will continue counting where it left off. for the watchdog there is no difference between em0 and em1. the watchdog does not run in em4, and if em4block in wdog_ctrl is set, the cpu is prevented from entering em4. note if the wdog is clocked by the lfxo or lfrco, writing the swoscblock bit will effectively prevent the cpu from entering em3. when running from the ulfrco, writing the swoscblock bit will prevent the cpu from entering em4. 12.3.4 register access since this module is a low energy peripheral, and runs off a clock which is asynchronous to the hfcoreclk, special considerations must be taken when accessing registers. please refer to section 5.3 (p. 21 ) for a description on how to perform register accesses to low energy peripherals. note that clearing the en bit in wdog_ctrl will reset the wdog module, which will halt any ongoing register synchronization. note never write to the wdog registers when it is disabled, except to enable by setting the en bitfield in wdog_ctrl.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 159 www.energymicro.com 12.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 wdog_ctrl rw control register 0x004 wdog_cmd w1 command register 0x008 wdog_syncbusy r synchronization busy register 12.5 register description 12.5.1 wdog_ctrl - control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0xf 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw name clksel persel swoscblock em4block lock em3run em2run debugrun en bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:12 clksel 0x0 rw watchdog clock select selects the wdog oscillator, i.e. the clock on which the watchdog will run. value mode description 0 ulfrco ulfrco 1 lfrco lfrco 2 lfxo lfxo 11:8 persel 0xf rw watchdog timeout period select select watchdog timeout period. value description 0 timeout period of 9 watchdog clock cycles. 1 timeout period of 17 watchdog clock cycles. 2 timeout period of 33 watchdog clock cycles. 3 timeout period of 65 watchdog clock cycles. 4 timeout period of 129 watchdog clock cycles. 5 timeout period of 257 watchdog clock cycles. 6 timeout period of 513 watchdog clock cycles. 7 timeout period of 1k watchdog clock cycles. 8 timeout period of 2k watchdog clock cycles. 9 timeout period of 4k watchdog clock cycles. 10 timeout period of 8k watchdog clock cycles. 11 timeout period of 16k watchdog clock cycles. 12 timeout period of 32k watchdog clock cycles. 13 timeout period of 64k watchdog clock cycles. 14 timeout period of 128k watchdog clock cycles. 15 timeout period of 256k watchdog clock cycles.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 160 www.energymicro.com bit name reset access description 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 swoscblock 0 rw software oscillator disable block set to disallow disabling of the selected wdog oscillator. writing this bit to 1 will turn on the selected wdog oscillator if it is not already running. value description 0 software is allowed to disable the selected wdog oscillator. see cmu for detailed description. note that also cmu registers are lockable. 1 software is not allowed to disable the selected wdog oscillator. 5 em4block 0 rw energy mode 4 block set to prevent the emu from entering em4. value description 0 em4 can be entered. see emu for detailed description. 1 em4 cannot be entered. 4 lock 0 rw configuration lock set to lock the watchdog configuration. this bit can only be cleared by reset. value description 0 watchdog configuration can be changed. 1 watchdog configuration cannot be changed. 3 em3run 0 rw energy mode 3 run enable set to keep watchdog running in em3. value description 0 watchdog timer is frozen in em3. 1 watchdog timer is running in em3. 2 em2run 0 rw energy mode 2 run enable set to keep watchdog running in em2. value description 0 watchdog timer is frozen in em2. 1 watchdog timer is running in em2. 1 debugrun 0 rw debug mode run enable set to keep watchdog running in debug mode. value description 0 watchdog timer is frozen in debug mode. 1 watchdog timer is running in debug mode. 0 en 0 rw watchdog timer enable set to enabled watchdog timer. 12.5.2 wdog_cmd - command register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name clear
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 161 www.energymicro.com bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 clear 0 w1 watchdog timer clear clear watchdog timer. the bit must be written 4 watchdog cycles before the timeout. value mode description 0 unchanged watchdog timer is unchanged. 1 cleared watchdog timer is cleared to 0. 12.5.3 wdog_syncbusy - synchronization busy register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access r r name cmd ctrl bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 cmd 0 r cmd register busy set when the value written to cmd is being synchronized. 0 ctrl 0 r ctrl register busy set when the value written to ctrl is being synchronized.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 162 www.energymicro.com 13 prs - peripheral reflex system 0 1 2 3 4 tim er adc dma prs ch prs ch quick facts what? the prs (peripheral reflex system) allows configurable, fast and autonomous communication between the peripherals. why? events and signals from one peripheral can be used as input signals or triggers by other peripherals and ensure timing-critical operation and reduced software overhead. how? without cpu intervention the peripherals can send reflex signals (both pulses and level) to each other in single- or chained steps. the peripherals can be set up to perform actions based on the incoming reflex signals. this results in improved system performance and reduced energy consumption. 13.1 introduction the peripheral reflex system (prs) system is a network which allows the different peripheral modules to communicate directly with each other without involving the cpu. peripheral modules which send out reflex signals are called producers. the prs routes these reflex signals to consumer peripherals which apply actions depending on the reflex signals received. the format for the reflex signals is not given, but edge triggers and other functionality can be applied by the prs. 13.2 features ? 12 configurable interconnect channels ? each channel can be connected to any producing peripheral ? consumers can choose which channel to listen to ? selectable edge detector (rising, falling and both edges) ? software controlled channel output ? configurable level ? triggered pulses 13.3 functional description an overview of the prs module is shown in figure 13.1 (p. 163 ) . the prs contains 12 interconnect channels, and each of these can select between all the output reflex signals offered by the producers. the consumers can then choose which prs channel to listen to and perform actions based on the reflex signals routed through that channel. the reflex signals can be both pulse signals and level signals. synchronous prs pulses are one hfperclk cycle long, and can either be sent out by a producer (e.g., adc conversion complete) or be generated from the edge detector in the prs channel. level signals can have an arbitrary waveform (e.g., timer pwm output).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 163 www.energymicro.com 13.3.1 asynchronous mode many reflex signals can operate in two modes, synchronous or asynchronous. a synchronous reflex is clocked on hfperclk, and can be used as an input to all reflex consumers, but since they require hfperclk, they will not work in em2/em3. asynchronous reflexes are not clocked on hfperclk, and can be used even in em2/em3. there is a limitation to reflexes operating in asynchronous mode though: they can only be used by a subset of the reflex consumers, the ones marked with async support in table 13.2 (p. 165 ) . peripherals that can produce asynchronous reflexes are marked with async support in table 13.1 (p. 164 ) . to use these reflexes asynchronously, set async in the chctrl register for the prs channel selecting the reflex signal. note if a peripheral channel with async set is used in a consumer not supporting asynchronous reflexes, the behaviour is undefined. 13.3.2 channel functions different functions can be applied to a reflex signal within the prs. each channel includes an edge detector to enable generation of pulse signals from level signals. it is also possible to generate output reflex signals by configuring the swpulse and swlevel bits. swlevel is a programmable level for each channel and holds the value it is programmed to. the swpulse will give out a one-cycle high pulse if it is written to 1, otherwise a 0 is asserted. the swlevel and swpulse signals are then xor'ed with the selected input from the producers to form the output signal sent to the consumers listening to the channel. note the edge detector controlled by edsel should only be used when working with synchronous reflexes, i.e., async in chctrl is cleared. figure 13.1. prs overview apb int erface reg sigsel[ 2:0] edsel[ 1:0] apb bus signals from producer peripherals signals t o consum er peripherals swpulse[ n] swlevel[ n] sourcesel[ 5:0] async[ n] 13.3.3 producers each prs channel can choose between signals from several producers, which is configured in sourcesel in prs_chx_ctrl. each of these producers outputs one or more signals which can be selected by setting the sigsel field in prs_chx_ctrl. setting the sourcesel bits to 0 (off) leads to a constant 0 output from the input mux. an overview of the available producers is given in table 13.1 (p. 164 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 164 www.energymicro.com table 13.1. reflex producers module reflex output output format async support acmp comparator output level yes single conversion done pulse adc scan conversion done pulse channel 0 conversion done pulse dac channel 1 conversion done pulse pin 0 input level yes pin 1 input level yes pin 2 input level yes pin 3 input level yes pin 4 input level yes pin 5 input level yes pin 6 input level yes pin 7 input level yes pin 8 input level yes pin 9 input level yes pin 10 input level yes pin 11 input level yes pin 12 input level yes pin 13 input level yes pin 14 input level yes gpio pin 15 input level yes overflow pulse yes compare match 0 pulse yes rtc compare match 1 pulse yes underflow pulse overflow pulse cc0 output level cc1 output level timer cc2 output level ch0 level letimer ch1 level tx complete pulse uart rx data received pulse
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 165 www.energymicro.com module reflex output output format async support tx complete pulse rx data received pulse usart irda decoder output level vcmp comparator output level yes scanres register level yes lesense decoder output level/pulse yes overflow pulse yes burtc compare match 0 pulse yes 13.3.4 consumers consumer peripherals (listed in table 13.2 (p. 165 ) ) can be set to listen to a prs channel and perform an action based on the signal received on that channel. most consumers expect pulse input, while some can handle level inputs as well. table 13.2. reflex consumers module reflex input input format async support single mode trigger pulse adc scan mode trigger pulse channel 0 trigger pulse dac channel 1 trigger pulse cc0 input pulse/level cc1 input pulse/level cc2 input pulse/level dti fault source 0 (timer0 only) pulse dti fault source 1 (timer0 only) pulse timer dti input (timer0 only) pulse/level tx/rx enable pulse uart rx input pulse/level yes tx/rx enable pulse irda encoder input (usart0 only) pulse usart rx input pulse/level yes leuart rx input pulse/level yes s0 input level yes pcnt s1 input level yes lesense start scan pulse/level yes
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 166 www.energymicro.com module reflex input input format async support decoder bit 0 level yes decoder bit 1 level yes decoder bit 2 level yes decoder bit 3 level yes note it is possible to output prs channel 0 - channel 3 onto the gpio by setting ch0pen, ch1pen, ch2pen, or ch3pen in the prs_route register. 13.3.5 example the example below (illustrated in figure 13.2 (p. 166 ) ) shows how to set up adc0 to start single conversions every time timer0 overflows (one hfperclk cycle high pulse), using prs channel 5: ? set sourcesel in prs_ch5_ctrl to 0b011100 to select timer0 as input to prs channel 5. ? set sigsel in prs_ch5_ctrl to 0b001 to select the overflow signal (from timer0). ? configure adc0 with the desired conversion set-up. ? set singleprsen in adc0_singlectrl to 1 to enable single conversions to be started by a high prs input signal. ? set singleprssel in adc0_singlectrl to 0x5 to select prs channel 5 as input to start the single conversion. ? start timer0 with the desired top value, an overflow prs signal is output automatically on overflow. note that the adc results needs to be fetched either by the cpu or dma. figure 13.2. timer0 overflow starting adc0 single conversions through prs channel 5. prs timer0 adc0 ch0 ch 1 ch 2 ch 3 ch 4 ch 5 ch 6 ch 7 st art single conv. overflow
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 167 www.energymicro.com 13.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 prs_swpulse w1 software pulse register 0x004 prs_swlevel rw software level register 0x008 prs_route rw i/o routing register 0x010 prs_ch0_ctrl rw channel control register ... prs_chx_ctrl rw channel control register 0x03c prs_ch11_ctrl rw channel control register 13.5 register description 13.5.1 prs_swpulse - software pulse register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name ch11pulse ch10pulse ch9pulse ch8pulse ch7pulse ch6pulse ch5pulse ch4pulse ch3pulse ch2pulse ch1pulse ch0pulse bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11pulse 0 w1 channel 11 pulse generation see bit 0. 10 ch10pulse 0 w1 channel 10 pulse generation see bit 0. 9 ch9pulse 0 w1 channel 9 pulse generation see bit 0. 8 ch8pulse 0 w1 channel 8 pulse generation see bit 0. 7 ch7pulse 0 w1 channel 7 pulse generation see bit 0. 6 ch6pulse 0 w1 channel 6 pulse generation see bit 0. 5 ch5pulse 0 w1 channel 5 pulse generation see bit 0. 4 ch4pulse 0 w1 channel 4 pulse generation see bit 0. 3 ch3pulse 0 w1 channel 3 pulse generation see bit 0. 2 ch2pulse 0 w1 channel 2 pulse generation see bit 0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 168 www.energymicro.com bit name reset access description 1 ch1pulse 0 w1 channel 1 pulse generation see bit 0. 0 ch0pulse 0 w1 channel 0 pulse generation write to 1 to generate one hfperclk cycle high pulse. this pulse is xor'ed with the corresponding bit in the swlevel register and the selected prs input signal to generate the channel output. 13.5.2 prs_swlevel - software level register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw name ch11level ch10level ch9level ch8level ch7level ch6level ch5level ch4level ch3level ch2level ch1level ch0level bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 ch11level 0 rw channel 11 software level see bit 0. 10 ch10level 0 rw channel 10 software level see bit 0. 9 ch9level 0 rw channel 9 software level see bit 0. 8 ch8level 0 rw channel 8 software level see bit 0. 7 ch7level 0 rw channel 7 software level see bit 0. 6 ch6level 0 rw channel 6 software level see bit 0. 5 ch5level 0 rw channel 5 software level see bit 0. 4 ch4level 0 rw channel 4 software level see bit 0. 3 ch3level 0 rw channel 3 software level see bit 0. 2 ch2level 0 rw channel 2 software level see bit 0. 1 ch1level 0 rw channel 1 software level see bit 0. 0 ch0level 0 rw channel 0 software level the value in this register is xor'ed with the corresponding bit in the swpulse register and the selected prs input signal to generate the channel output.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 169 www.energymicro.com 13.5.3 prs_route - i/o routing register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 access rw rw rw rw rw name location ch3pen ch2pen ch1pen ch0pen bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 location 0x0 rw i/o location decides the location of the prs i/o pins. value mode description 0 loc0 location 0 1 loc1 location 1 7:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 ch3pen 0 rw ch3 pin enable when set, gpio output from prs channel 3 is enabled 2 ch2pen 0 rw ch2 pin enable when set, gpio output from prs channel 2 is enabled 1 ch1pen 0 rw ch1 pin enable when set, gpio output from prs channel 1 is enabled 0 ch0pen 0 rw ch0 pin enable when set, gpio output from prs channel 0 is enabled 13.5.4 prs_chx_ctrl - channel control register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 0x00 0x0 access rw rw rw rw name async edsel sourcesel sigsel bit name reset access description 31:29 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 28 async 0 rw asynchronous reflex set to disable synchronization of this reflex signal 27:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:24 edsel 0x0 rw edge detect select select edge detection. value mode description 0 off signal is left as it is
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 170 www.energymicro.com bit name reset access description value mode description 1 posedge a one hfperclk cycle pulse is generated for every positive edge of the incoming signal 2 negedge a one hfperclk clock cycle pulse is generated for every negative edge of the incoming signal 3 bothedges a one hfperclk clock cycle pulse is generated for every edge of the incoming signal 23:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21:16 sourcesel 0x00 rw source select select input source to prs channel. value mode description 0b000000 none no source selected 0b000001 vcmp voltage comparator 0b000010 acmp0 analog comparator 0 0b000011 acmp1 analog comparator 1 0b000110 dac0 digital to analog converter 0 0b001000 adc0 analog to digital converter 0 0b010000 usart0 universal synchronous/asynchronous receiver/transmitter 0 0b010001 usart1 universal synchronous/asynchronous receiver/transmitter 1 0b010010 usart2 universal synchronous/asynchronous receiver/transmitter 2 0b011100 timer0 timer 0 0b011101 timer1 timer 1 0b011110 timer2 timer 2 0b011111 timer3 timer 3 0b100100 usb universal serial bus interface 0b101000 rtc real-time counter 0b101001 uart0 universal asynchronous receiver/transmitter 0 0b101010 uart1 universal asynchronous receiver/transmitter 0 0b110000 gpiol general purpose input/output 0b110001 gpioh general purpose input/output 0b110100 letimer0 low energy timer 0 0b110111 burtc backup rtc 0b111001 lesensel low energy sensor interface 0b111010 lesenseh low energy sensor interface 0b111011 lesensed low energy sensor interface 15:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2:0 sigsel 0x0 rw signal select select signal input to prs channel. value mode description sourcesel = 0b000000 (none) 0bxxx off channel input selection is turned off sourcesel = 0b000001 (vcmp) 0b000 vcmpout voltage comparator output vcmpout sourcesel = 0b000010 (acmp0) 0b000 acmp0out analog comparator output acmp0out sourcesel = 0b000011 (acmp1) 0b000 acmp1out analog comparator output acmp1out sourcesel = 0b000110 (dac0) 0b000 dac0ch0 dac ch0 conversion done dac0ch0 0b001 dac0ch1 dac ch1 conversion done dac0ch1 sourcesel = 0b001000 (adc0) 0b000 adc0single adc single conversion done adc0single
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 171 www.energymicro.com bit name reset access description value mode description 0b001 adc0scan adc scan conversion done adc0scan sourcesel = 0b010000 (usart0) 0b000 usart0irtx usart 0 irda out usart0irtx 0b001 usart0txc usart 0 tx complete usart0txc 0b010 usart0rxdatav usart 0 rx data valid usart0rxdatav sourcesel = 0b010001 (usart1) 0b001 usart1txc usart 1 tx complete usart1txc 0b010 usart1rxdatav usart 1 rx data valid usart1rxdatav sourcesel = 0b010010 (usart2) 0b001 usart2txc usart 2 tx complete usart2txc 0b010 usart2rxdatav usart 2 rx data valid usart2rxdatav sourcesel = 0b011100 (timer0) 0b000 timer0uf timer 0 underflow timer0uf 0b001 timer0of timer 0 overflow timer0of 0b010 timer0cc0 timer 0 compare/capture 0 timer0cc0 0b011 timer0cc1 timer 0 compare/capture 1 timer0cc1 0b100 timer0cc2 timer 0 compare/capture 2 timer0cc2 sourcesel = 0b011101 (timer1) 0b000 timer1uf timer 1 underflow timer1uf 0b001 timer1of timer 1 overflow timer1of 0b010 timer1cc0 timer 1 compare/capture 0 timer1cc0 0b011 timer1cc1 timer 1 compare/capture 1 timer1cc1 0b100 timer1cc2 timer 1 compare/capture 2 timer1cc2 sourcesel = 0b011110 (timer2) 0b000 timer2uf timer 2 underflow timer2uf 0b001 timer2of timer 2 overflow timer2of 0b010 timer2cc0 timer 2 compare/capture 0 timer2cc0 0b011 timer2cc1 timer 2 compare/capture 1 timer2cc1 0b100 timer2cc2 timer 2 compare/capture 2 timer2cc2 sourcesel = 0b011111 (timer3) 0b000 timer3uf timer 3 underflow timer3uf 0b001 timer3of timer 3 overflow timer3of 0b010 timer3cc0 timer 3 compare/capture 0 timer3cc0 0b011 timer3cc1 timer 3 compare/capture 1 timer3cc1 0b100 timer3cc2 timer 3 compare/capture 2 timer3cc2 sourcesel = 0b100100 (usb) 0b000 usbsof usb start of frame usbsof 0b001 usbsofsr usb start of frame sent/received usbsofsr sourcesel = 0b101000 (rtc) 0b000 rtcof rtc overflow rtcof 0b001 rtccomp0 rtc compare 0 rtccomp0 0b010 rtccomp1 rtc compare 1 rtccomp1 sourcesel = 0b101001 (uart0) 0b001 uart0txc usart 0 tx complete uart0txc 0b010 uart0rxdatav usart 0 rx data valid uart0rxdatav sourcesel = 0b101010 (uart1) 0b001 uart1txc usart 0 tx complete uart1txc 0b010 uart1rxdatav usart 0 rx data valid uart1rxdatav sourcesel = 0b110000 (gpio)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 172 www.energymicro.com bit name reset access description value mode description 0b000 gpiopin0 gpio pin 0 gpiopin0 0b001 gpiopin1 gpio pin 1 gpiopin1 0b010 gpiopin2 gpio pin 2 gpiopin2 0b011 gpiopin3 gpio pin 3 gpiopin3 0b100 gpiopin4 gpio pin 4 gpiopin4 0b101 gpiopin5 gpio pin 5 gpiopin5 0b110 gpiopin6 gpio pin 6 gpiopin6 0b111 gpiopin7 gpio pin 7 gpiopin7 sourcesel = 0b110001 (gpio) 0b000 gpiopin8 gpio pin 8 gpiopin8 0b001 gpiopin9 gpio pin 9 gpiopin9 0b010 gpiopin10 gpio pin 10 gpiopin10 0b011 gpiopin11 gpio pin 11 gpiopin11 0b100 gpiopin12 gpio pin 12 gpiopin12 0b101 gpiopin13 gpio pin 13 gpiopin13 0b110 gpiopin14 gpio pin 14 gpiopin14 0b111 gpiopin15 gpio pin 15 gpiopin15 sourcesel = 0b110100 (letimer0) 0b000 letimer0ch0 letimer ch0 out letimer0ch0 0b001 letimer0ch1 letimer ch1 out letimer0ch1 sourcesel = 0b110111 (burtc) 0b000 burtcof burtc overflow burtcof 0b001 burtccomp0 burtc compare 0 burtccomp0 sourcesel = 0b111001 (lesense) 0b000 lesensescanres0 lesense scanres register, bit 0 lesensescanres0 0b001 lesensescanres1 lesense scanres register, bit 1 lesensescanres1 0b010 lesensescanres2 lesense scanres register, bit 2 lesensescanres2 0b011 lesensescanres3 lesense scanres register, bit 3 lesensescanres3 0b100 lesensescanres4 lesense scanres register, bit 4 lesensescanres4 0b101 lesensescanres5 lesense scanres register, bit 5 lesensescanres5 0b110 lesensescanres6 lesense scanres register, bit 6 lesensescanres6 0b111 lesensescanres7 lesense scanres register, bit 7 lesensescanres7 sourcesel = 0b111010 (lesense) 0b000 lesensescanres8 lesense scanres register, bit 8 lesensescanres8 0b001 lesensescanres9 lesense scanres register, bit 9 lesensescanres9 0b010 lesensescanres10 lesense scanres register, bit 10 lesensescanres10 0b011 lesensescanres11 lesense scanres register, bit 11 lesensescanres11 0b100 lesensescanres12 lesense scanres register, bit 12 lesensescanres12 0b101 lesensescanres13 lesense scanres register, bit 13 lesensescanres13 0b110 lesensescanres14 lesense scanres register, bit 14 lesensescanres14 0b111 lesensescanres15 lesense scanres register, bit 15 lesensescanres15 sourcesel = 0b111011 (lesense) 0b000 lesensedec0 lesense decoder prs out 0 lesensedec0 0b001 lesensedec1 lesense decoder prs out 1 lesensedec1 0b010 lesensedec2 lesense decoder prs out 2 lesensedec2
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 173 www.energymicro.com 14 ebi - external bus interface 0 1 2 3 4 ebi ( efm32) ext ernal async . device parallel int erface quick facts what? the ebi is used for accessing external parallel devices. the devices appear as a part of the EFM32WG's internal memory map and are therefore extremely simple to use. why? even though the EFM32WG is versatile, there might be a need for specific external devices such as extra ram, flash, lcd , tft . the ebi simplifies the access to such devices. how? through memory mapping the devices appear as a part of the internal memory map. when the processor performs read or writes to the address range of the ebi, the ebi handles the data transfers to and from the external devices. the ebi may be interfaced by the dma, thus enabling operation in em1. 14.1 introduction the external bus interface provides access to external parallel interface devices such as sram, flash, adcs and lcds. the interface is memory mapped into the address bus of the cortex-m4. this enables seamless access from software without manually manipulating the io settings each time a read or write is performed. the data and address lines can be multiplexed in order to reduce the number of pins required to interface the external devices. the bus timing is adjustable to meet specifications of the external devices. the interface is limited to asynchronous devices and tft . 14.2 features ? programmable interface for various memory types ? 4 memory bank regions ? individual chip select line (ebi_csn) per memory bank ? accurate control of setup, strobe, hold and turn-around timing per memory bank ? individual active high / active low setting of interface control signals per memory bank ? slave read/write cycle extension per memory bank ? page mode read ? nand flash support ? both multiplexed and non-multiplexed address and data line configurations ? up to 28 address lines ? up to 16-bit data bus width ? automatic translation when ahb transaction width and memory width differ ? configurable prefetch from external device ? write buffer to limit stalling of the cortex-m4 or dma ? tft direct drive ? programmable display and porch sizes
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 174 www.energymicro.com ? programmable bus timing (frequency, setup and hold timing) ? individual active high / active low setting of interface control signals ? frame buffer can be either on-chip or off-chip ? alpha-blending and masking 14.3 functional description an overview of the ebi module is shown in figure 14.1 (p. 175 ) . the ebi module consists of two submodules. the first submodule implements a generic external device interface to for example sram or flash devices. the second submodule implements a tft rgb interface which can be used together with the generic external device interface to perform tft direct drive from an external framebuffer to a tft display. the ebi has multiplexed and non-multiplexed addressing modes. fastest operation is achieved when using a non-multiplexed addressing mode. the multiplexed addressing modes are somewhat slower and require an external latch, but they use a significantly lower number of pins. the use of the 16 ebi_ad pin connections depends on the addressing mode. they are used for both address and data in the multiplexed modes. also for the non-multiplexed 8-bit address mode both the address and data fit into these 16 ebi_ad pins. if more address bits or data bits are needed, external latches can be used to support up to 24-bit addresses or 16-bit data in the multiplexed addressing modes using only the 16 ebi_ad pins. furthermore, independent of the addressing mode, up to 28 non-multiplexed address lines can be enabled on the ebi_a pin connections. when a read operation is requested by the cortex-m4 or dma via the ebi's ahb interface, the address is transferred onto the ebi_ad and/or ebi_a bus. after a specific number of cycles, the ebi_ren pin is activated and data is read from the ebi_ad bus. when a write operation is requested, the address is transferred onto the ebi_ad and/or ebi_a bus and subsequently the write data is transferred onto the ebi_ad bus as the ebi_wen pin is activated. the detailed operation in the supported modes is presented in the following sections.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 175 www.energymicro.com figure 14.1. ebi overview tim ing ahb ebi_ad[ 15:0] apb control dat a/address ebi_ren ebi_bln[ 1:0] ebi_csn[ 3:0] ebi_ardy ebi_ale polarit y mode tft tim ing ahb apb tft control ebi_dclk ebi_dataen ebi_vsync ebi_hsync ebi_cstftn tft polarit y tft size ebi_a[ 27:0] ebi_wen ebi_nandwen ebi_nandren mem ory int erface ebi tft int erface 14.3.1 non-multiplexed 8-bit data, 8-bit address mode in this mode, 8-bit address and 8-bit data is supported. the address is put on the higher 8 bits of the ebi_ad lines while the data uses the lower 8 bits. this mode is set by programming the mode field in the ebi_ctrl register to d8a8. the address space can be extended to 256 mb by using the ebi_a lines as described in section 14.3.6 (p. 180 ) . read and write signals in 8-bit mode are shown in figure 14.2 (p. 176 ) and figure 14.3 (p. 176 ) respectively.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 176 www.energymicro.com figure 14.2. ebi non-multiplexed 8-bit data, 8-bit address read operation addr[ 7:0] ebi_ad[ 15:8] rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_ren z rdhold ( 0 , 1 , 2 , ...) z data[ 7:0] z ebi_ad[ 7:0] figure 14.3. ebi non-multiplexed 8-bit data, 8-bit address write operation addr[ 7:0] ebi_ad[ 15:8] wrsetup ( 0 , 1 , 2 , ...) wrstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_wen z data[ 7:0] z ebi_ad[ 7:0] wrhold ( 0 , 1 , 2 , ...) 14.3.2 multiplexed 16-bit data, 16-bit address mode in this mode, 16-bit address and 16-bit data is supported, but the utilization of an external latch is required. the 16-bit address and 16-bit data bits are multiplexed on the ebi_ad lines. an illustration of such a setup is shown in figure 14.4 (p. 176 ) . this mode is set by programming the mode field in the ebi_ctrl register to d16a16ale. note in this mode the 16-bit address is organized in 2-byte chunks at memory addresses aligned to 2-byte offsets. consequently, the lsb of the 16-bit address will always be 0. in order to double the address space, the 16-bit address is internally shifted one bit to the right so that the lsb of the address driven into the ebi_ad bus, i.e. the ebi_ad[0]-bit, corresponds to the second least significant bit of the address, i.e. addr[1]. at the external device, the lsb of the address must be tied either low or high in order to create a full address. figure 14.4. ebi address latch setup ebi ( efm32) ext ernal async . device lat ch ebi_ad addr data cont rol ale at the start of the transaction the address is output on the ebi_ad lines. the latch is controlled by the ale (address latch enable) signal and stores the address. then the data is read or written according
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 177 www.energymicro.com to operation. read and write signals are shown in figure 14.5 (p. 177 ) and figure 14.6 (p. 177 ) respectively. figure 14.5. ebi multiplexed 16-bit data, 16-bit address read operation addr[ 16:1] ebi_ad[ 15:0] ebi_ale addrsetup ( 1 , 2 , 3 , ...) z data[ 15:0] ebi_csn ebi_ren z rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) rdhold ( 0 , 1 , 2 , ...) figure 14.6. ebi multiplexed 16-bit data, 16-bit address write operation addr[ 16:1] ebi_ad[ 15:0] ebi_ale addrsetup ( 1 , 2 , 3 , ...) data[ 15:0] ebi_csn ebi_wen z wrsetup ( 0 , 1 , 2 , ...) wrstrb ( 1 , 2 , 3 , ...) wrhold ( 0 , 1 , 2 , ...) addrhold ( 0 , 1 , 2 , ...) 14.3.3 multiplexed 8-bit data, 24-bit address mode this mode allows 24-bit address with 8-bit data multiplexed on the ebi_ad lines. the upper 8 bits of the ebi_ad lines are consecutively used for the highest 8 bits and the lowest 8 bits of the address. the lower 8 bits of the ebi_ad lines are used for the middle 8 address bits and for data. this mode is set by programming the mode field in the ebi_ctrl register to d8a24ale. read and write signals are shown in figure 14.7 (p. 177 ) and figure 14.8 (p. 178 ) respectively. figure 14.7. ebi multiplexed 8-bit data, 24-bit address read operation addr[ 23:16] ebi_ad[ 15:8] ebi_ale addrsetup ( 1 , 2 , 3 , ...) rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_ren z rdhold ( 0 , 1 , 2 , ...) addr[ 15:8] z data[ 7:0] z ebi_ad[ 7:0] addr[ 7:0]
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 178 www.energymicro.com figure 14.8. ebi multiplexed 8-bit data, 24-bit address write operation addr[ 23:16] ebi_ad[ 15:8] ebi_ale addrsetup ( 1 , 2 , 3 , ...) addrhold ( 0 , 1 , 2 , ...) wrsetup ( 0 , 1 , 2 , ...) ebi_csn ebi_wen z wrstrb ( 1 , 2 , 3 , ...) addr[ 15:8] data[ 7:0] z ebi_ad[ 7:0] addr[ 7:0] wrhold ( 0 , 1 , 2 , ...) 14.3.4 non-multiplexed 16-bit data, n-bit address mode in this non-multiplexed mode 16-bit data is driven on the 16 ebi_ad lines. the addresses are driven on the ebi_a lines. the address space can be up to 256 mb as described in section 14.3.6 (p. 180 ) . this mode is set by programming the mode field in the ebi_ctrl register to d16. read and write signals are shown in figure 14.9 (p. 178 ) and figure 14.10 (p. 178 ) respectively for the case in which n address lines on ebi_a have been enabled. note in this mode the 16-bit address is organized in 2-byte chunks at memory addresses aligned to 2-byte offsets. consequently, the lsb of the 16-bit address will always be 0. in order to double the address space, the 16-bit address is internally shifted one bit to the right so that the lsb of the address driven into the ebi_a bus, i.e. the ebi_a[0]-bit, corresponds to the second least significant bit of the address, i.e. addr[1]. at the external device, the lsb of the address must be tied either low or high in order to create a full address. figure 14.9. ebi non-multiplexed 16-bit data read operation with extended address addr[ n:1] ebi_a[ n-1:0] rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_ren z rdhold ( 0 , 1 , 2 , ...) z data[ 15:0] z ebi_ad[ 15:0] figure 14.10. ebi non-multiplexed 16-bit data write operation with extended address addr[ n:1] ebi_a[ n-1:0] wrsetup ( 0 , 1 , 2 , ...) wrstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_wen z data[ 15:0] z ebi_ad[ 15:0] wrhold ( 0 , 1 , 2 , ...)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 179 www.energymicro.com 14.3.5 page mode read operation page mode read operation can enhance the performance of a sequence of consecutive asynchronous read transactions by allowing data at subsequent intrapage addresses to be read faster. page mode operation is enabled by setting the pagemode bitfield in the ebi_rdtiming (or ebi_rdtimingn) register to 1. if enabled, the rdpa bitfield in the ebi_pagectrl register defines the duration of an intrapage access and the pagelen bitfield in the ebi_pagectrl register defines the number of members in a page. page mode reads can for example be triggered by consecutive reads resulting from wide ahb reads which are automatically translated into multiple narrow external device reads. page mode reads can also be triggered by sequential reads resulting from the ebi prefetch unit. the number of members in a page together with the width of the external device and the inchit bit of the ebi_pagectrl register define whether an address change results in an interpage access or in an intrapage access as shown in table 14.1 (p. 179 ) . table 14.1. ebi intrapage hit condition for read on address addr (non-mentioned addr bits are unchanged) pagelen, inchit 8-bit external device 16-bit external device pagelen=member4, inchit=0 addr[1:0] changed addr[2:0] changed pagelen=member8, inchit=0 addr[2:0] changed addr[3:0] changed pagelen=member16, inchit=0 addr[3:0] changed addr[4:0] changed pagelen=member32, inchit=0 addr[4:0] changed addr[5:0] changed pagelen=member4, inchit=1 addr[1:0] incremented by 1 addr[2:0] incremented by 2 pagelen=member8, inchit=1 addr[2:0] incremented by 1 addr[3:0] incremented by 2 pagelen=member16, inchit=1 addr[3:0] incremented by 1 addr[4:0] incremented by 2 pagelen=member32, inchit=1 addr[4:0] incremented by 1 addr[5:0] incremented by 2 the initial page mode transaction uses the read setup and read strobe timing as shown in figure 14.2 (p. 176 ) , figure 14.5 (p. 177 ) , figure 14.7 (p. 177 ) or figure 14.9 (p. 178 ) depending on the used addressing mode. subsequent transactions are started by changing the low-order address bits and use the page access time defined in the rdpa bitfield of the ebi_pagectrl register. the read hold state rdhold is only performed at the end of a page mode read sequence or when bus turn- around occurs. note that bus turn-around can occur even if only read transactions are performed as the d16a16ale addressing mode will drive the ebi_ad lines when programming the external address latch. in this case one bus turn-around rdholdx cycle is automatically inserted in between the read and the write action on the ebi_ad lines. note that for the d16a16ale addressing mode the rdpa state immediately follows the addrsetup state, so the halfale feature will typically be required to satisfy the external address latch hold requirement. in the d8a24ale addressing mode there is no need to reprogram the external address latch for intrapage addresses as the external latch then only latches the most significant, non-changed address lines. the following figures show typical page mode read sequences for all addressing modes. figure 14.11. ebi page mode read operation for d8a8 addressing mode addr0 ebi_ad[ 15:8] rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_ren rdhold ( 0 , 1 , 2 , ...) z data0 ebi_ad[ 7:0] data1 data2 data3 addr1 addr2 addr3 z z rdpa ( 1 , 2 , 3 , ...) rdpa ( 1 , 2 , 3 , ...) rdpa ( 1 , 2 , 3 , ...)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 180 www.energymicro.com figure 14.12. ebi page mode read operation for d16a16ale addressing mode addr0 ebi_ad[ 15:0] ebi_ale addrsetup ( 1 , 2 , 3 , ...) z data0 ebi_csn ebi_ren rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) rdhold ( 0 , 1 , 2 , ...) addr1 z data1 rdsetup ( 0 , 1 , 2 , ...) rdpa ( 1 , 2 , 3 , ...) rdhold ( 0 , 1 , 2 , ...) addrsetup ( 1 , 2 , 3 , ...) z figure 14.13. ebi page mode read operation for d8a24ale addressing mode addr0[ 23:16] ebi_ad[ 15:8] addrsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) ebi_csn rdhold ( 0 , 1 , 2 , ...) data0 ebi_ad[ 7:0] data1 data2 data3 addr1[ 7:0] addr2[ 7:0] addr3[ 7:0] z z rdpa ( 1 , 2 , 3 , ...) rdpa ( 1 , 2 , 3 , ...) rdpa ( 1 , 2 , 3 , ...) ebi_ale ebi_ren rdsetup ( 0 , 1 , 2 , ...) addr0[ 15:8] addr0[ 7:0] z figure 14.14. ebi page mode read operation for d16 addressing mode addr0 ebi_a[ n-1:0] rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_ren rdhold ( 0 , 1 , 2 , ...) z data0 ebi_ad[ 15:0] data1 data2 data3 addr1 addr2 addr3 z z rdpa ( 1 , 2 , 3 , ...) rdpa ( 1 , 2 , 3 , ...) rdpa ( 1 , 2 , 3 , ...) the maximum duration that a page is kept open is defined in the keepopen bitfield of the ebi_pagectrl register. new read transactions which hit in an open page are started with rdpa intrapage timing if the keepopen time has not been exceeded at the start of such a transaction. the default setting of keepopen, which is equal to 0, will therefore never allow for intrapage timing to occur. transactions are allowed to finish if the keepopen time is exceeded during the transaction. otherwise the rdstrb interpage timing is used for the read transaction. next to exceeding the keepopen time there are other reasons for closing an open page. in particular ebi transactions which result in a write or a non-intrapage read always cause the page to be closed. also the lack of a new ebi transaction will cause an open page to be closed. in order to prevent this last scenario as much as possible read transactions can often be made back to back. this is achieved by enabling prefetching by setting prefetch to 1 in the ebi_rdtiming (or ebi_rdtimingn) register and by disallowing idle state insertion in between transfers by setting the noidle (or noidlen) bit to 1 in ebi_ctrl register. figure 14.15 (p. 180 ) shows an example in which only addr1 benefits from intrapage timing because an unrelated ahb transfer not directed at the ebi causes late arrival of addr2. addr2 arrives too late to be inserted as a back to back read transfer. the page is considered closed and addr2 can therefore not benefit from intrapage timing and it results in an interpage access instead. figure 14.15. ebi page closing addr0 ebi_a[ n-1:0] rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_ren rdhold ( 0 , 1 , 2 , ...) z data0 ebi_ad[ 15:0] data1 addr1 z addr2 rdpa ( 1 , 2 , 3 , ...) addr0 ahb address non-ebi addr2 addr1 rdsetup ( 0 , 1 , 2 , ...) z rdstrb ( 1 , 2 , 3 , ...) idle 14.3.6 extended addressing extended addressing is used to extend the address range for any of the addressing modes described in section 14.3.4 (p. 178 ) , section 14.3.1 (p. 175 ) , section 14.3.2 (p. 176 ) and section 14.3.3 (p. 177 ) . up to 28 address bits can be individually enabled on the ebi_a address lines providing up to 256 mb of address space per memory bank. the operation on the ebi_ad lines is not affected by this. see section 14.3.12 (p. 185 ) for the memory map definitions related to the ebi. an example of address
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 181 www.energymicro.com extension for the d16 mode is shown in figure 14.9 (p. 178 ) and figure 14.10 (p. 178 ) . a further example for address extension in the multiplexed 16-bit data, 16-bit address mode of section 14.3.2 (p. 176 ) is shown in figure 14.16 (p. 181 ) . this is achieved by programming the mode field in the ebi_ctrl register to d16a16ale and by enabling the required address lines via the alb and apen bitfields of the ebi_route register. figure 14.16. ebi extended address latch setup ebi ( efm32) ext ernal async . device lat ch ebi_ad addr lsbs data cont rol ale addr msbs ebi_a read and write signals for using extended addressing in the d16a16ale mode are shown in figure 14.17 (p. 181 ) and figure 14.18 (p. 181 ) respectively for the case in which n extra address lines have been enabled. at the start of the transaction the lower address bits are output on the ebi_ad lines. the latch is controlled by the ale (address latch enable) signal and stores the address. then the data is read or written according to operation. the higher address bits are output on the ebi_a lines throughout the transfer. figure 14.17. ebi 16-bit data multiplexed read operation using extended addressing addr[ 16:1] ebi_ad[ 15:0] ebi_ale addrsetup ( 1 , 2 , 3 , ...) z data[ 15:0] ebi_csn ebi_ren z rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) rdhold ( 0 , 1 , 2 , ...) addr[ 16+ n:17] ebi_a[ 16+ n-1:16] figure 14.18. ebi 16-bit data multiplexed write operation using extended addressing addr[ 16:1] ebi_ad[ 15:0] ebi_ale addrsetup ( 1 , 2 , 3 , ...) data[ 15:0] ebi_csn ebi_wen z wrsetup ( 0 , 1 , 2 , ...) wrstrb ( 1 , 2 , 3 , ...) wrhold ( 0 , 1 , 2 , ...) addrhold ( 0 , 1 , 2 , ...) addr[ 16+ n:17] ebi_a[ 16+ n-1:16] in order to minimize the pin requirements both the lower bound and the upper bound of the enabled ebi_a lines can be set. this is done in the alb and apen bitfields of the ebi_route register respectively. for example, in case all memory banks use the 8-bit addressing mode d8a8, then the
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 182 www.energymicro.com lower 8 address bits are always output on ebi_ad. therefore, if address extension is required, only address bits 8 and upwards need to be enabled on ebi_a. this is done by setting the ebi_a lower bound to 8 by setting alb to a8 in ebi_route and by enabling the required higher address lines via the apen bitfield in ebi_route. the operation of the apen and alb bitfields is shown in table 14.2 (p. 182 ) for some typical configurations. table 14.2. ebi enabling ebi_addr lines for transaction with address addr and data data configuration addresses on ebi_a addresses/data on ebi_ad mode = d8a8, alb = a8, apen = a28 ebi_a[27:8] = addr[27:8] ebi_ad[15:0] = {addr[7:0], data[7:0]} mode = d16a16ale, alb = a16, apen = a27 ebi_a[26:16] = addr[27:17] ebi_ad[15:0] = addr[16:1]; data[15:0] mode = d8a24ale, alb = a24, apen = a28 ebi_a[27:24] = addr[27:24] ebi_ad[15:0] = addr[23:8]; {addr[7:0], data[7:0]} mode = d16, alb = a0, apen = a27 ebi_a[26:0] = addr[27:1] ebi_ad[15:0] = data[15:0] 14.3.7 prefetch unit and write buffer prefetching from external memory can enhance the performance of a sequence of consecutive transfers. in particular sequential code execution from external memory can benefit from prefetch. also prefetch will typically lead to better utilization of intrapage accesses in case page mode is used. if prefetch is enabled, the prefetch unit will sequentially prefetch one data item of the same width as the last cortex-m4 or dma read transaction handled by the ebi. note that one prefetch transaction might lead to multiple external device transactions as described in table 14.3 (p. 185 ) . prefetch is not performed in reaction to write transactions, nor will prefetch cross bank boundaries. the prefetch unit is enabled via the prefetch bitfield in the ebi_rdtiming and ebi_rdtimingn registers. when the its bitfield in the ebi_ctrl register is set to 0, the prefetch bitfield from ebi_rdtiming applies to all 4 memory banks. when its is set to 1 the prefetch unit can be individually enabled per bank. in this case register ebi_rdtiming only applies to bank 0. prefetch enabling for bank n is then defined in the ebi_rdtimingn register. the ebi has a 1 entry 32-bit wide write buffer. the write buffer can be used to limit stalling by partially decoupling the cortex-m4 or dma from a potentially slow external device. only writes which are guaranteed to not cause an error (e.g. timeout) in the ebi will be buffered when the write buffer is enabled, such that precise error generation is guaranteed. the write buffer is disabled via the wbufdis bitfield in the ebi_wrtiming and ebi_wrtimingn registers. when the its bitfield in the ebi_ctrl register is set to 0, the wbufdis bitfield from ebi_wrtiming applies to all 4 memory banks. when its is set to 1 the write buffer can be individually disabled per bank. in this case register ebi_wrtiming only applies to bank 0. write buffer disabling for bank n is then defined in the ebi_wrtimingn register. the ahbact status bit in the ebi_status register indicates whether an ahb transaction is still active in the ebi or not. when performing an ahb write, the ahbact bit stays 1 until the required transaction(s) with the external device have finished, independent of whether the ahb write gets buffered or not. on an ahb read with prefetching enabled, ahbact stays high until the potential external device prefetch transaction(s) have finished. 14.3.8 strobe length for external devices with low, but non-zero, setup requirements the performance overhead for ebi transactions can be relatively large if a full cycle setup time needs to be used. it is possible to borrow half of the cycle time from a neighboring strobe phase in order to define setup times with a granularity of half the internal clock period. the durations of the ebi_ale, ebi_ren, ebi_wen, ebi_nandren and ebi_nandwen strobes can be individually decreased by half the internal clock period via the halfale, halfre and halfwe bitfields in the address timing, read timing and write timing registers respectively. in case of ebi_ale the trailing edge of the strobe can be moved half a clock period earlier. in case of ebi_ren, ebi_wen,
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 183 www.energymicro.com ebi_nandren and ebi_nandwen the leading edge of the strobe can be moved half a clock period later. decreasing the length of the ebi_ale strobe can be thought of as increasing the length of the rdsetup phase by the same amount. similarly, decreasing the length of the ebi_ren, ebi_wen, ebi_nandren, ebi_nandwen strobes can be thought of as increasing the length of the rdsetup and wrsetup phases. note that the length of the addrsetup, rdstrb, and wrstrb phases is still 1 or more internal clock cycles. for example, when halfre is set to 1 and rdstrb is programmed to 2, the length of the rdstrb phase is 2 cycles. the duration of the ebi_ren pulse is however decreased by half a cycle to 1 1/2 cycles. figure 14.5 (p. 177 ) and figure 14.6 (p. 177 ) respectively show read and write transactions in the multiplexed 16-bit address, 16-bit data mode in which half strobes are enabled for ebi_ale, ebi_ren and ebi_wen. figure 14.19. ebi multiplexed read operation with reduced length strobes addr[ 16:1] ebi_ad[ 15:0] ebi_ale addrsetup ( 1 , 2 , 3 , ...) z data[ 15:0] ebi_csn ebi_ren z rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) rdhold ( 0 , 1 , 2 , ...) (? , 1 ? , 2 ? , ...) (? ) (? , 1 ? , 2 ? , ...) (? ) figure 14.20. ebi multiplexed write operation with reduced length strobes addr[ 16:1] ebi_ad[ 15:0] ebi_ale addrsetup ( 1 , 2 , 3 , ...) data[ 15:0] ebi_csn ebi_wen z addrhold ( 0 , 1 , 2 , ...) wrstrb ( 1 , 2 , 3 , ...) wrhold ( 0 , 1 , 2 , ...) (? , 1 ? , 2 ? , ...) (? ) (? , 1 ? , 2 ? , ...) (? ) wrsetup ( 0 , 1 , 2 , ...) 14.3.9 bus turn-around and idle cycles the ebi_ad lines can be driven by either the EFM32WG or by the external device. depending on the characteristics of an external device, the rdhold should be programmed to ensure adequate bus turn- around time. default the ebi inserts an initial idle cycle, during which the ebi does not drive the ebi_ad lines, after each external transaction. furthermore, the ebi deasserts the ebi_csn, ebi_ren, and ebi_wen lines during idle cycles. in case of subsequent idle cycles, after the initial one, the ebi will drive the ebi_ad lines while keeping the ebi_csn, ebi_ren, and ebi_wen lines deasserted. the idle state insertion is shown for two back-to-back read transactions in figure 14.21 (p. 184 ) . in case that the idle state provides the required bus turn-around time, the rdhold parameter can be programmed to 0. for increased performance, the automatic idle state insertion can be prevented by setting the noidle/noidlen bits in the ebi_ctrl register to 1. this scenario is shown in figure 14.22 (p. 184 ) for two back-to-back reads in a non-multiplexed addressing mode. note that in case rdsetup and rdhold are both programmed to 0, then the ebi_ren line will not be deasserted between back-to- back read transfers. the same will happen for non-multiplexed back-to-back write transactions with wrsetup and wrhold both programmed to 0. in case that noidle/noidlen is 1 and a read is immediately followed by a write on the ebi_ad lines, one bus turn-around cycle called rdholdx is automatically inserted in between the read and the write action. during a rdholdx cycle the external ebi signals are driven in the same way as during regular rdhold cycles, i.e. the ebi_ren line will get deasserted while the ebi_csn line will stay asserted. an idle cycle will automatically get inserted for the following cases: ? between two external device transactions in case the noidle/noidlen bit is 0. ? between two external device transactions to different banks. ? when no request for an external transaction is available in the ebi.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 184 www.energymicro.com a rdholdx cycle will automatically get inserted for the following case: ? between a read and a subsequent write on the ebi_ad lines. note that this is only possible if noidle/ noidlen is set to 1. also note that a read in a multiplexed addressing mode (e.g. d16a16ale) starts with a write on the ebi_ad lines when it is in the addrsetup state. figure 14.21. ebi enforced idle cycles between transactions addr0[ 7:0] ebi_ad[ 15:8] rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_ren rdhold ( 0 , 1 , 2 , ...) z data0[ 7:0] ebi_ad[ 7:0] addr1[ 7:0] z data1[ 7:0] idle ( 1 , 2 , ...) rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) rdhold ( 0 , 1 , 2 , ...) idle ( 1 , 2 , ...) figure 14.22. ebi no enforced idle cycles between transactions addr0[ 7:0] ebi_ad[ 15:8] rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) ebi_csn ebi_ren rdhold ( 0 , 1 , 2 , ...) z data0[ 7:0] ebi_ad[ 7:0] addr1[ 7:0] z data1[ 7:0] rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) rdhold ( 0 , 1 , 2 , ...) note in case noidle/noidlen bits are set in ebi_ctrl the read or write strobes can remain asserted for back-to-back transfers if no further separation is guaranteed via for example rdsetup, rdhold, wrsetup, or wrhold bitfields. 14.3.10 timing the duration of the states in the transaction is defined by the corresponding uppercase name above the state, e.g. the address setup state in figure 14.8 (p. 178 ) is active for a number of internal clock cycles defined by addrset bitfield in the ebi_addrtiming register. similar timing can be defined by the rdstrb bitfield in the ebi_rdtiming register and wrstrb in the ebi_wrtiming register. these parameters all have a minimum duration of 1 cycle, which is set by hw in case the bitfield is programmed to 0. the setup and hold timing parameters are addrhold in the ebi_addrtiming register, rdhold and rdsetup in the ebi_rdtiming register and wrhold and wr setup in the ebi_wrtiming register. writing a value m to one of these bitfields results in a duration of the corresponding state of m cycles. if these parameters are set to 0, it effectively means that the state is skipped. page mode access time is defined in the rdpa bitfield of the ebi_pagectrl register. this parameters has a minimum duration of 1 cycle, which is set by hw in case the bitfield is programmed to 0. when the its bitfield in the ebi_ctrl register is set to 0, the timing set defined in the ebi_addrtiming, ebi_rdtiming and ebi_wrtiming registers applies to all 4 memory banks. when its is set to 1 each memory bank uses an individual timing set. in this case registers ebi_addrtiming, ebi_rdtiming and ebi_wrtiming only apply to bank 0. timing for bank n is then defined in the ebi_addrtimingn, ebi_rdtimingn and ebi_wrtimingn registers. note all timing related bitfields have a default value which is equal to the highest possible value for these bitfields, which makes the default values a better fit for slow memory devices. this differs from the efm32g devices in which the default values correspond to the lowest possible values, which would only be appropriate for fast memory devices.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 185 www.energymicro.com 14.3.11 data access width the mapping of ahb transactions to external device accesses depends on the data width of the external device and on whether or not it supports byte lanes. the data width of external devices is specified in the mode and moden bitfields of the ebi_ctrl register. an external device is specified to be either 8-bit or 16-bit wide. availability of byte lane support by the external device is specified via the bl and bln bitfields of the ebi_ctrl register. when the its bitfield in the ebi_ctrl register is set to 0, the mode and bl bitfields apply to all 4 memory banks. when its is set to 1 each memory bank uses an individual mode and byte lane enable definition. in this case bitfields mode and bl only apply to bank 0. the mode and byte lane availability for bank n is then defined in the moden and bln bitfields. in case the ahb transaction width does not match the width of the selected device, the ebi automatically translates the ahb transaction into 1 or more external device transactions matching the capabilities of that device. if one ahb transaction is translated into multiple external transactions, then the external transactions have incrementing addresses and start with the lowest data byte(s) from the ahb transaction. the translation, and possibly bus fault generation, is explained below and in table 14.3 (p. 185 ) : ? if the ahb transaction width is larger than the external device width, then multiple consecutive external transactions are performed starting with the least significant data. ? if the ahb transaction width is smaller than the external device width, then ebi behavior depends on whether or not byte lanes are available for the selected device. reads either use byte lane support when available, or read according to the full external device width and disregard the superfluous data. writes normally either use byte lane support when available, or perform a read-modify-write sequence to only change the required data. however, nand flash does not support byte lanes or random access read-modify-write and therefore a hard fault is generated in case of an 8-bit write to a bank designated as 16-bit nand bank. table 14.3. ebi mapping of ahb transactions to external device transactions data access by cortex- m4, dma, or prefetch 8-bit external device (non- nand) transaction(s) 16-bit external device (non- nand) transaction(s) (with byte lanes) 16-bit external device (non- nand) transaction(s) (without byte lanes) 8-bit nand flash transaction(s) 16-bit nand flash transaction(s) 8-bit read 1 x 8-bit read 1 x 8-bit read (using byte lane) 1 x 16-bit read 1 x 8-bit read 1 x 16-bit read 16-bit read 2 x 8-bit read 1 x 16-bit read 1 x 16-bit read 2 x 8-bit read 1 x 16-bit read 32-bit read 4 x 8-bit read 2 x 16-bit read 2 x 16-bit read 4 x 8-bit read 2 x 16-bit read 8-bit write 1 x 8-bit write 1 x 8-bit write (using byte lane) 1 x 16-bit read; 1 x 16-bit write (read-modify- write) 1 x 8-bit write - (hard fault) 16-bit write 2 x 8-bit write 1 x 16-bit write 1 x 16-bit write 2 x 8-bit write 1 x 16-bit write 32-bit write 4 x 8-bit write 2 x 16-bit write 2 x 16-bit write 4 x 8-bit write 2 x 16-bit write 14.3.12 bank access the ebi is split in 4 different address regions, each connected to an individual ebi_csn line. when accessing one of the memory regions, the corresponding csn line is asserted. this way up to 4 separate devices can share the ebi lines and be identified by the ebi_csn line. each bank can individually be enabled or disabled in the ebi_ctrl register. the bank separation depends on whether the access originates from code space or not and on the setting of the altmap bit in the ebi_ctrl register. from code space three 32 mb banks and one 128
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 186 www.energymicro.com mb bank can be accessed. from data space either four 64 mb banks (when altmap bit is 0) or four 256 mb banks (when the altmap bit is 1) can be accessed as shown in figure 14.23 (p. 186 ) and figure 14.24 (p. 187 ) respectively. the ebi regions starting at address 0x80000000 in the memory map of the EFM32WG can also be used for code execution. when running code via ebi regions starting at this address, the cortex-m4 uses the system bus interface to fetch instructions. this results in reduced performance as the cortex-m4 accesses stack, other data in sram and peripherals using the system bus interface. code accesses via the system bus interface will not be cached. furthermore, it should be noted that the address area from 0xa0000000 to 0xc0000000 is marked nx (no-execute) by default. to be able to run code via the ebi efficiently, the ebi is also mapped in the code space at address 0x12000000. when running code from this space, the cortex-m4 fetches instructions through the i/d-code bus interface, leaving the system bus interface for data access. instructions fetched via the i/d-code bus interface can be cached to increase performance. the ebi regions mapped into the code space can however only be accessed by the cpu, i.e. not the dma. depending on the setting of the its bitfield in the ebi_ctrl register. the external device behavior, including for example data width, timing definitions, page mode operation, and pin polarities, is either defined for all banks at once or individually per bank. figure 14.23. ebi default memory map (altmap = 0) ebi region 0 (32 mb) code 0 x0 0 0 0 0 0 0 0 0 x1 f f f f f f f 0 x2 0 0 0 0 0 0 0 0 x7 f f f f f f f 0 x1 2 0 0 0 0 0 0 ebi region 1 (32 mb) ebi region 2 (32 mb) 0 x1 3 f f f f f f 0 x1 4 0 0 0 0 0 0 0 x1 5 f f f f f f 0 x1 6 0 0 0 0 0 0 0 x1 7 f f f f f f 0 x1 8 0 0 0 0 0 0 0 x1 f f f f f f f ebi region 3 (128 mb) ebi region 0 (64 mb) 0 x8 0 0 0 0 0 0 0 ebi region 2 (64 mb) ebi region 1 (64 mb) 0 x8 3 f f f f f f 0 x8 4 0 0 0 0 0 0 0 x8 7 f f f f f f 0 x8 8 0 0 0 0 0 0 0 x8 b f f f f f f 0 x8 c0 0 0 0 0 0 0 x8 f f f f f f f ebi region 3 (64 mb) ebi regions 0 x8 0 0 0 0 0 0 0 0 xb f f f f f f f 0 xc0 0 0 0 0 0 0 0 xf f f f f f f f 0 x1 2 0 0 0 0 0 0 0 x8 f f f f f f f
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 187 www.energymicro.com figure 14.24. ebi alternative memory map (altmap = 1) ebi region 0 (32 mb) code 0 x0 0 0 0 0 0 0 0 0 x1 f f f f f f f ebi regions 0 x8 0 0 0 0 0 0 0 0 xb f f f f f f f 0 xc0 0 0 0 0 0 0 0 xf f f f f f f f 0 x2 0 0 0 0 0 0 0 0 x7 f f f f f f f 0 x1 2 0 0 0 0 0 0 ebi region 1 (32 mb) ebi region 2 (32 mb) 0 x1 3 f f f f f f 0 x1 4 0 0 0 0 0 0 0 x1 5 f f f f f f 0 x1 6 0 0 0 0 0 0 0 x1 7 f f f f f f 0 x1 8 0 0 0 0 0 0 0 x1 f f f f f f f ebi region 3 (128 mb) ebi region 0 (256 mb) 0 x8 0 0 0 0 0 0 0 ebi region 2 (256 mb) ebi region 1 (256 mb) 0 x8 f f f f f f f 0 x9 0 0 0 0 0 0 0 0 x9 f f f f f f f 0 xa 0 0 0 0 0 0 0 0 xa f f f f f f f 0 xb 0 0 0 0 0 0 0 0 xb f f f f f f f ebi region 3 (256 mb) 0 x1 2 0 0 0 0 0 0 14.3.13 wait/ardy. some external devices are able to indicate that they are not finished with either write or read operation by asserting the wait / ardy line. this input signal is used to extend the ren/wen cycles for slow devices. the interpretation of the polarity of this signal can be configured with the ardypol bit in ebi_polarity. e.g. if the ardypol is set to activelow, then the ren/wen cycle is extended while the ardy line is kept low. the ardy functionality is enabled by setting the ardyen bit in the ebi_ctrl register. it is also possible to enable a timeout check, which generates a bus error if the ardy is not deasserted within the timeout period. this prevents a system lock up condition in the case that the external device does not deassert ardy. the timeout functionality is disabled by setting ardytodis in the ebi_ctrl register. when the its bitfield in the ebi_ctrl register is set to 0, the wait behavior defined in the ardyen and ardytodis bitfields applies to all 4 memory banks. when its is set to 1 each memory bank uses an individual wait behavior definition. in this case bitfields ardyen and ardytodis only apply to bank 0. wait behavior for bank n is then defined in the ardynen and ardytondis bitfields.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 188 www.energymicro.com 14.3.14 nand flash support nand flash devices offer high density at relatively low cost when compared to nor flash devices. unlike nor flash, which offers random read access, nand flash devices are based on page access and use an indirect interface. furthermore, a nand flash can contain invalid bits leading to invalid blocks, which leads to requirements such as bit error detection/correction and bad block management. the ebi offers support for glueless connection of a nand flash by implementing dedicated ebi_nandren and ebi_nandwen pins and by providing hardware for single error correction double error detection (sec-ded) error correction code (ecc) generation. nand flash support is enabled by setting the en bitfield in the ebi_nandctrl register to 1. the banksel bitfield in ebi_nandctrl defines which memory bank has a nand flash devices attached to it. nand flash data width, read timing, and write timing are programmed via the standard ebi registers as described in section 14.3.14.2 (p. 189 ) . ecc support is described in section 14.3.15 (p. 193 ) . both standard and chip enable don't care (cedc) nand flash devices are supported and they can be attached as shown in figure 14.25 (p. 188 ) and figure 14.26 (p. 189 ) respectively. for standard nand flash devices, the chip enable (cen) pin needs to remain asserted low during the entire read cycle busy period, in which data is transferred from the memory array into the nand flash internal data registers in order to prevent an early return to standby mode. cedc nand flash devices do not have this restriction, but they do not support the automatic sequential read function. for cedc nand flash the shared ebi_ren and ebi_wen pins can be used instead of the dedicated ebi_nandren and ebi_nandwen pins. figure 14.25. ebi connection with standard nand flash ebi ( efm32) nand flash gpio cle ale r/b cen wpn io[ ] wen ren ebi_nandren gpio ( 0 ) ebi_a[ 25] ( 1 ) ebi_a[ 24] ( 1 ) ebi_nandwen ebi_ad[ ] ( 3 ) gpio ( 4 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 189 www.energymicro.com figure 14.26. ebi connection with chip enable don't care nand flash ebi ( efm32) ce don?t care nand flash gpio cle ale r/b cen wpn io[ ] wen ren ebi_nandren ( 2 ) gpio ( 4 ) ebi_csn ebi_a[ 25] ( 1 ) ebi_a[ 24] ( 1 ) ebi_nandwen ( 2 ) ebi_ad[ ] ( 3 ) note ? (0) for a standard nand flash the ebi_csn should be left unconnected. ? (1) the address lines mapping to the nand flash ale and cle signals can be chosen as explained in section 14.3.14.1 (p. 189 ) ? (2) for a cedc nand flash the shared ebi_ren and ebi_wen pins can be used instead of the dedicated ebi_nandren and ebi_nandwen pins ? (3) both 8-bit and 16-bit nand flash are supported. ? (4) the nand flash ready/busy (r/b) signal should be observed via gpio (not via ebi_ardy) 14.3.14.1 register selection nand flash uses an indirect i/o interface in which the nand flash is controlled by programming the nand flash internal command, address, and data registers. nand flash does not use dedicated address lines. because of this indirect i/o interface the nand flash memory size is not restricted by the memory map of the EFM32WG. the nand command, address, and data registers can be accessed via memory mapped io in which two address lines are chosen for connection with the ale and cle signals. the memory mapping and the two used address lines should be chosen such that they adhere to the ale/cle encoding shown in table 14.4 (p. 189 ) . either ebi_a or ebi_ad address lines can be used as long as the chosen addressing mode does not multiplex data signals onto the chosen lines. the ebi_a[25:24] address lines used in figure 14.25 (p. 188 ) and figure 14.26 (p. 189 ) are just an example. table 14.4. ebi nand flash register select ale cle selected nand flash register 0 0 data register 0 1 command register 1 0 address register 1 1 undefined 14.3.14.2 width and timing configuration the regular ebi registers are used for defining transfer width, read timing, and write timing for the transactions on the nand flash interface. nand flash specific parameters as for example block size or
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 190 www.energymicro.com the number of address cycles are not configured in the ebi and need to be dealt with via driver software. also higher level tasks as for example wear-leveling, bad block management, and logical-to-physical block mapping should be addressed via driver software. external transaction width is defined via the address mode as defined in mode field of ebi_ctrl. as only 3 nand flash registers are memory mapped it suffices to use either the d8a8 or d16 address mode. the d16a16ale and d8a24ale address modes can also be used, but they require unnecessary external address latch cycles and/or circuitry. for a 8-bit wide nand flash device, the d8a8 address mode is therefore recommended, whereas for a 16-bit wide nand flash device the d16 address mode is recommended. if the ahb transaction width does not match the external nand device transaction width, then automatic transaction translation is performed as described in section 14.3.11 (p. 185 ) . note that a bus fault is generated in case of an 8-bit write to a 16-bit nand device as neither byte lanes nor read-modify-write is supported for nand flash. nand flash write timing is defined in the ebi_wrtiming(n) register. figure 14.27 (p. 190 ) , figure 14.28 (p. 190 ) , and figure 14.29 (p. 191 ) show the command latch, address latch and data input timing respectively assuming the d8a8 address mode with ebi_ad[x] used as ale and ebi_ad[y] used as cle. figure 14.27. ebi nand flash command latch timing ebi_ad[ y] = nand cle wrsetup ( 0 , 1 , 2 , ...) wrstrb ( 1 , 2 , 3 , ...) gpio or ebi_csn = nand cen ebi_nandwen = nand wen command ebi_ad[ 7:0] = nand io wrhold ( 0 , 1 , 2 , ...) ebi_ad[ x] = nand ale t ds t dh t cs t ch t cls t als t clh t alh t wp gpio = nand r/b t wb figure 14.28. ebi nand flash address latch timing ebi_ad[ y] = nand cle wrsetup ( 0 , 1 , 2 , ...) wrstrb ( 1 , 2 , 3 , ...) gpio or ebi_csn = nand cen ebi_nandwen = nand wen address ebi_ad[ 7:0] = nand io wrhold ( 0 , 1 , 2 , ...) ebi_ad[ x] = nand ale t ds t dh t cs t ch t cls t als t clh t alh t wp t wh t wc
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 191 www.energymicro.com figure 14.29. ebi nand flash data input timing ebi_ad[ y] = nand cle wrsetup ( 0 , 1 , 2 , ...) wrstrb ( 1 , 2 , 3 , ...) gpio or ebi_csn = nand cen ebi_nandwen = nand wen data in ebi_ad[ 7:0] = nand io wrhold ( 0 , 1 , 2 , ...) ebi_ad[ x] = nand ale t ds t dh t cs t ch t cls t als t clh t alh t wp t wh t wc the ebi_wrtiming(n) setting requirements for satisfying the nand flash timing parameters for command latching, address latching and data input timing are shown in table 14.5 (p. 191 ) . table 14.5. ebi nand flash write timing nand flash write timing parameter ebi write timing parameter requirements tadl <= t(wrhold) + t(wrsetup) + t(wrstrb) tals <= t(wrsetup) + t(wrstrb) tcs <= t(wrsetup) + t(wrstrb) tcls <= t(wrsetup) + t(wrstrb) tds <= t(wrsetup) + t(wrstrb) talh <= t(wrhold) tch <= t(wrhold) tclh <= t(wrhold) tdh <= t(wrhold) twc <= t(wrhold) + t(wrsetup) + t(wrstrb) twh <= t(wrhold) + t(wrsetup) twp <= t(wrstrb) twb (r/b edges can be detected by edge triggered gpio interrupts) nand flash read timing is defined in the ebi_rdtiming(n) register. figure 14.30 (p. 192 ) shows the nand flash data output timing assuming the d8a8 address mode.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 192 www.energymicro.com figure 14.30. ebi nand flash data output timing rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) gpio or ebi_csn = nand cen ebi_nandwen = nand ren data out ebi_ad[ 7:0] = nand io rdhold ( 0 , 1 , 2 , ...) t rhoh t rp z z t reh gpio = nand r/b t rr t cea t rea t rhz t rc the ebi_rdtiming(n) setting requirements for satisfying the nand flash timing parameters for data output timing are shown in table 14.6 (p. 192 ) . table 14.6. ebi nand flash read timing nand read timing parameter ebi read timing parameter requirements tcea <= t(rdsetup) + t(rdstrb) trea <= t(rdstrb) trp <= t(rdstrb) trhz <= t(rdhold) treh <= t(rdhold) + t(rdsetup) trc <= t(rdhold) + t(rdsetup) + t(rdstrb) trr <= t(rdsetup) (assuming software wait for r/b high) tar <= t(rdsetup) tclr <= t(rdsetup) tir <= t(rdsetup) the nand flash timing parameters twhr and trhw define separation of read and write pulses and therefore they can be satisfied by a combination of ebi_rdtiming(n) and ebi_wrtiming(n) settings as shown in table 14.7 (p. 192 ) . table 14.7. ebi nand flash read/write timing requirements nand timing parameter ebi timing parameter twhr <= t(wrhold) + t(rdsetup) trhw <= t(rdhold) + t(wrsetup) remaining nand flash timing parameters, e.g. trst and tprog, should be dealt with in software. 14.3.14.3 application examples a typical 528-byte page read sequence for an 8-bit wide nand flash is as follows: ? configuration: enable and select the memory bank connected to the nand flash device via the en and banksel bitfields in the ebi_nandctrl register. set the mode field of the ebi_ctrl register to d8a8 indicating that the attached device is 8-bit wide. program the ebi_rdtiming and ebi_wrtiming registers to fulfill the nand timing requirements.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 193 www.energymicro.com ? command and address phase: program the nand command register to the page read command and program the nand address register to the required read address. this can be done via cortex- m4 or dma writes to the memory mapped nand command and address registers. the automatic data access width conversions described in section 14.3.11 (p. 185 ) can be used if desired to for example automatically perform 4 consecutive address byte transactions in response to one 32-bit word ahb write to the nand address register (in this case the 2 address lsbs should not be used to map onto the nand ale/cle signals). ? data transfer phase: wait for the nand flash internal data transfer phase to complete as indicated via its ready/busy (r/b) pin. the user can use the gpio interrupt functionality for this. the 528-byte data is now ready for sequential transfer from the nand flash data register. ? read phase: clear the ecc_parity register and start error code correction (ecc) parity generation by setting both the eccstart and eccclear bitfields in the ebi_cmd register to 1. now all subsequently transferred data to/from the nand flash devices is used to generate the ecc parity code into the ebi_eccparity register. read 512 subsequent bytes of main area data from the nand flash data register via dma transfers. this can for example be done via 32-bit word dma transfers (as long as the two address lsbs are not used to map onto the nand ale/cle signals). stop ecc parity generation by setting the eccstop bitfield in the ebi_cmd register to 1 so that following transactions will not modify the parity result. read out the final 16 bytes from the nand flash spare data area. ? error correction phase: compare the ecc code contained in the read spare area data against the computed ecc code from the ebi_eccparity register. the user software can accept, correct, or discard the read data according the comparison result. no automatic correction is performed. a typical 528-byte page program sequence for an 8-bit wide nand flash is as follows: ? configuration: configure the ebi for nand flash support via the ebi_nandctrl, ebi_ctrl, ebi_rdtiming and ebi_wrtiming registers. ? command and address phase: program the nand command register to command for page programming (serial data input) and program the nand address register to the desired write address. ? write phase: clear the ecc_parity register and start error code correction (ecc) parity generation by setting both the eccstart and eccclear bitfields in the ebi_cmd register to 1. now all subsequently transferred data to/from the nand flash devices is used to generate the ecc parity code into the ebi_eccparity register. write 512 subsequent bytes of user main data to the nand flash data register via for example dma transfers. stop ecc parity generation and read out the computed ecc parity data from ebi_eccparity. write the final 16 bytes of spare data including the computed ecc parity data bytes. ? program phase: write the auto program command to the nand flash command register after which the nand flash will indicate that it is busy via its read/busy (r/b) pin. after read/busy goes high again, the success of the program command can be verified by programming the read status command. 14.3.15 error correction code the ebi provides provides hardware support for generation of an error correction code (ecc). the used ecc is a hamming (hsiao) code providing single bit error correction and double error detection (sec- ded). ecc can be used to detect and/or correct failing bits in a nand flash page. ecc generation is enabled by setting bitfield eccstart in the ebi_cmd register to 1. all subsequent data traffic to/from the memory bank specified in the banksel bitfield of the ebi_nandctrl register is then used for generation of the ecc into the ebi_eccparity register independent of the address in that bank. ecc generation is stopped by writing 1 to the eccstop bitfield in the ebi_cmd register. the ebi_eccparity register is cleared by writing 1 to the eccclear register. the eccact status bit in the ebi_status register shows whether ecc generation is active or not. the ecc computation is as shown in figure 14.31 (p. 194 ) and table 14.8 (p. 194 ) . although the table only shows the ecc generation for 8-bit data transfers, the ecc hardware also works for 16-bit data transfers. in that case only the interpretation of the parity bits is different.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 194 www.energymicro.com figure 14.31. ebi ecc generation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 byt e 0 byt e 1 byt e 2 byt e 3 byt e n-4 byt e n-3 byt e n-2 byt e n-1 p8' p8 p8' p8 p32' p16 p16' p8' p8 p8' p8 p32 p16 p16' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p1 p1' p1 p1' p1 p1' p1 p1' p2 p2' p2 p2' p4 p4' table 14.8. ebi ecc bit/column parity parity bit generation for 8-bit data p1' bit 6 xor bit 4 xor bit 2 xor bit 0 xor p1' p1 bit 7 xor bit 5 xor bit 3 xor bit 1 xor p1 p2' bit 5 xor bit 4 xor bit 1 xor bit 0 xor p2' p2 bit 7 xor bit 6 xor bit 3 xor bit 2 xor p2 p4' bit 3 xor bit 2 xor bit 1 xor bit 0 xor p4' p4 bit 7 xor bit 6 xor bit 5 xor bit 4 xor p4 table 14.9. ebi ecc byte/row parity parity bit generation for 8-bit data rp(x) byte(x)(7) xor byte(x)(6) xor byte(x)(5) xor byte(x)(4) xor byte(x)(3) xor byte(x)(2) xor byte(x)(1) xor byte(x)(0) p8' rp(0) xor rp(2) xor rp(4) xor rp(6) xor ... xor rp(n-4) xor rp(n-2) p8 rp(1) xor rp(3) xor rp(5) xor rp(7) xor ... xor rp(n-3)xor rp(n-1) p16' rp(0) xor rp(1) xor rp(4) xor rp(5) xor ... xor rp(n-4) xor rp(n-3) p16 rp(2) xor rp(3) xor rp(6) xor rp(7) xor ... xor rp(n-2) xor rp(n-1) etc. etc. the generated ecc code can be read from the ebi_eccparity register according to the format shown in figure 14.32 (p. 195 ) . the number of valid ecc bits depends on the number of transferred bytes during the time that the ecc hardware is running as indicated in table 14.10 (p. 195 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 195 www.energymicro.com figure 14.32. ebi ebi_eccparity format p32768 p32768' p16384 p16384' p8192 p8192' p4096 p4096' ebi_eccparity[ 31:24] msb lsb p2048 p2048' p1024 p1024' p512 p512' p256 p256' ebi_eccparity[ 23:16] p128 p128' p64 p64' p32 p32' p16 p16' ebi_eccparity[ 15:8] p8 p8' p4 p4' p2 p2' p1 p1' ebi_eccparity[ 7:0] table 14.10. ebi ebi_eccparity valid bits number of data bytes used for ecc generation valid ebi_eccparity bits 256 ebi_eccparity[21:0] 512 ebi_eccparity[23:0] 1024 ebi_eccparity[25:0] 2048 ebi_eccparity[27:0] 4096 ebi_eccparity[29:0] 8192 ebi_eccparity[31:0] software can compare, xor, the parity data generated in ebi_eccparity with the parity information stored in the spare area for the used data set. the syndrome resulting from xor'ing the valid ebi_eccparity bits with the ecc code read from the spare area can be used for error detection and correction as shown in table 14.11 (p. 195 ) . table 14.11. ebi error detection result error detection result syndrome interpretation no error syndrome has all valid pn, pn' bits 0 no error has been detected 1-bit correctable error for all valid syndrome (pn, pn') pairs: pn = not(pn') 1 bit in the user main data is incorrect and it can be corrected. for 8-bit wide data the position of the incorrect bit is indicated by bit pattern (p4, p2, p1); the position of the incorrect byte is indicated by (..., p32, p16, p8). for 16-bit wide data the position of the incorrect bit is (p8, p4, p2, p1); the incorrect byte number is indicated by (..., p64, p32, p16) ecc error 1 bit of the xor result is high an error has been detected in the ecc itself. no error has been detected in the user data uncorrectable error other cases multiple (2 or more) bits are incorrect. this error cannot be corrected 14.3.16 tft direct drive tft direct drive can be used to automatically transfer frame data stored in either internal or external memory to a tft display without frame buffer. the ebi generates the necessary rgb control signals for the tft display and it coordinates and aligns the pixel data transfers accordingly. the direct drive engine is enabled by setting the dd bitfield in the ebi_tftctrl register to either internal or
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 196 www.energymicro.com external. the rgb interface consists of 8 or 16 data lines on ebi_ad together with the ebi_dataen, ebi_vsync, ebi_hsync and ebi_dclk control signals. ebi_tftcsn indicates whether the dd bitfield is programmed to disabled or not. whether direct drive is active or not can also be read via the ddact status bit in the ebi_status register. the dimensions of the visible display are defined in the vsz and hsz bitfields of the ebi_tftsize register. hardware automatically adds 1 to the size programmed in these bitfields. the front and back porch sizes are defined in the hfporch, hbporch, vfporch and vbporch bitfields of the ebi_tfthporch and ebi_tftvporch registers. the porch and visible display sizes define the number of ebi_dclk pulses per line and the number of lines per frame according to equation 14.1 (p. 196 ) and equation 14.2 (p. 196 ) respectively. ebi tft total width number of ebi_dclk pulses per line = hbporch + (hsz + 1) + hfporch (14.1) ebi tft total height number of lines per frame = vbporch + (vsz + 1) + vfporch (14.2) the horizontal and vertical synchronization pulses begin at the starts of the horizontal and vertical back porch intervals respectively. for the hsync pulse a delayed start position can be defined in the hsyncstart bitfield of the ebi_tfthporch register. the end of the hsync pulse is not delayed and therefore the hsync pulse width is shortened when using a non-zero hsyncstart. the widths, or rather end positions, of the hsync and vsync synchronization pulses are defined in the hsync and vsync bitfields of the ebi_tftsize register respectively. the horizontal synchronization pulse width is specified in pixels. the vertical synchronization pulse width is specified in lines. hardware automatically adds 1 to the width programmed in these bitfields. the ebi_tftsize bitfields are shown in figure 14.33 (p. 197 ) . when direct drive is enabled, the vcnt and hcnt bitfields in the ebi_tftstatus register show how the frame display progresses. vcnt is a counter containing the current line position in a frame. it counts from 0 (first line in the vertical back porch) to vbporch + vsz + vfporch (last line in the vertical front porch). hcnt is a counter containing the current pixel position within a line. it counts from 0 (first pixel in the horizonal back porch) to hbporch + hsz + hfporch (last pixel in the horizontal front porch).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 197 www.energymicro.com figure 14.33. ebi tft size visible display hsz+ 1 hfporch hbporch vsz+ 1 vfporch vbporch tot al widt h = hbporch + (hsz + 1) + hfporch tot al height = vbporch + (vsz + 1) + vfporch hsync+ 1 vsync+ 1 hcnt = 0 hcnt = hbporch+ hsz+ hfporch vcnt = vbporch+ vsz+ vfporch vcnt = vbporch+ vsz+ vfporch hcnt = 0 vcnt = 0 hcnt = hbporch+ hsz+ hfporch vcnt = 0 while the direct drive engine is transferring frame data from internal or external memory to the tft, the ebi can still be used for other ebi transfers to external devices. the interleaving of such ebi transfers with transfers originating from the direct drive engine is controlled via the interleave field in the ebi_tftctrl register. interleaving can be limited to occur only during the vertical and horizontal porch intervals by setting the interleave field to porch. ebi accesses outside the porch intervals while interleave is set to porch can cause the insertion of a high number of wait states on the ahb bus. in case the tft dot clock ebi_dclk is relatively slow compared to the external device access time, interleaving can also be allowed during the active interval of the tft by setting the interleave bitfield to oneperdclk or unlimited. in both cases interleaving during the porch intervals is unlimited as it is when the porch setting is used. if interleave is set to oneperdclk then at most 1 ebi access is inserted per ebi_dclk period in the active display interval at the point immediately after the pixel transfer. wait states are inserted on the ahb bus while waiting for this insertion point. the access time of such an interleaved transfer should be guaranteed by software to fit in the free interval between pixel transfers as indicated in figure 14.39 (p. 204 ) . if interleave is set to unlimited, which is the default, then there are no restrictions on performing ebi transactions during direct drive operation. although transactions related to direct drive have priority over other ebi transactions, jitter on the ebi_dclk can be introduced in case an ebi transaction is ongoing while the direct drive engine wants to insert its next transaction. in case the programmed ebi_dclk period can not be met, the ddjit interrupt flag in the ebi_if register is set and the ebi_dclk period is stretched to accommodate the delayed pixel data. note
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 198 www.energymicro.com if interleave is limited to porch only and zero porch sizes are programmed in the ebi_tfthporch and ebi_tftvporch registers, then no slots are left open for interleaving traffic and therefore interleaving ebi accesses can never finish. 14.3.16.1 direct drive from internal memory any internal memory can be used as the frame source location for direct drive. direct drive display from internal memory is started by setting the dd bitfield in the ebi_tftctrl register to internal. the tft controller indicates that the pixel buffer ebi_tftdd is empty and needs to be filled by raising the corresponding dma request. this dma request is initially set and it is cleared when ebi_tftdd is written. it is set again once the pixel data has been transferred to the display. one dma request is generated for each visible pixel. the direct drive engine will automatically align the data written to ebi_tftdd according to the setup and hold requirements with respect to ebi_dclk and send it out to the tft via the ebi_ad lines. whether the ebi_tftdd buffer is full or empty is also signaled by the ddempty interrupt flag in the ebi_if register and by the tftddempty status bit in the ebi_status register. given the relatively low performance of using software polling and interrupts compared to using dma, these non-dma mechanisms are only advised for very low pixel rates. if pixel data is not provided in time the ebi_dclk will be stretched to accommodate the late pixel data and the direct drive jitter interrupt flag ddjit in the ebi_if register is set. figure 14.34 (p. 198 ) shows the setup for direct drive from internal memory. figure 14.34. ebi tft direct drive from internal memory ebi_ad tft ebi_dclk ebi_dataen ebi_vsync, ebi_hsync ebi_tftcsn data mem ory efm32 ebi 14.3.16.2 direct drive from external memory direct drive can also use an external memory bank as the frame source location. the used bank is defined in the banksel bitfield of the ebi_tftctrl register. direct drive display from external memory is started by setting the dd bitfield in the ebi_tftctrl register to external. data is then streamed directly from the external memory to the tft. figure 14.35 (p. 199 ) and figure 14.36 (p. 199 ) show the setup for direct drive from external memory when using non-multiplexed and multiplexed address and data lines respectively.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 199 www.energymicro.com figure 14.35. ebi tft direct drive from external memory (non-multiplexed address/data) ebi ( efm32) ext ernal mem ory device ebi_ad addr data cont rol tft ebi_dclk ebi_dataen ebi_vsync, ebi_hsync ebi_tftcsn data ebi_a figure 14.36. ebi tft direct drive from external memory (multiplexed address/data) ebi ( efm32) ext ernal mem ory device lat ch ebi_ad addr data cont rol ebi_ale tft ebi_dclk ebi_dataen ebi_vsync, ebi_hsync ebi_tftcsn data the start address for the frame transfer is defined in the ebi_tftframebase register. the direct drive address is automatically incremented for each visible pixel and it does therefore not depend on the programmed porch sizes. the address increment depends on the width bitfield in the ebi_tftctrl register. the increment per visible pixel is 1 if the width bitfield in the ebi_tftctrl register is programmed to byte and it is 2 if width is programmed to halfword. additionally a horizontal stride is added to the direct drive address at the end of each visible line. this stride can be programmed in the hstride bitfield of the ebi_tftstride register. the first visible pixel always corresponds to the address defined in the ebi_tftframebase register. on either the vertical or horizontal synchronization event, as defined in the fbctrig bitfield of the ebi_tftctrl register, the ebi_tftframebase register is copied into an internal frame base buffer (fbc). this allows software to reprogram the ebi_tftframebase register based on vsync or hsync interrupts, which in turn can be used to for example implement double buffering or scrolling schemes. the hsync
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 200 www.energymicro.com and vsync interrupts are generated at the same time as the local copy of ebi_tftframebase is made. if software reprograms ebi_tftframebase in the interrupt service routine, then the new value will only be used for address generation of the next line (in case fbctrig equals hsync) or the next frame (in case fbctrig equals vsync). for example, when fbctrig equals hsync and the interrupt service routine triggered by the hsync interrupt reads vcnt as 0, then a software update of ebi_tftframebase will take effect for direct drive addresses of the line which corresponds to a vcnt value of 1. note that the ebi_tftstride register is not relevant in case the fbctrig is set to hsync as the hsync events reloads the internal frame base copy (fbc) with ebi_tftframebase at the start of each line. the direct drive address computation is summarized in figure 14.37 (p. 200 ) . figure 14.37. ebi direct drive address visible display p(0,0) local fram e base copy fbc get s assigned wit h ebi_tftframebase on every ebi_vsync st obe. p(1,0) p(2,0) p(3,0) p(hsz,0) p(0,1) p(1,1) p(2,1) p(3,1) p(hsz,1) p(0,2) p(1,2) p(2,2) p(3,2) p(hsz,2) p(0,vsz) p(1,vsz) p(2,vsz) p(3,vsz) p(hsz,vsz) hfporch hbporch vfporch vbporch the address increm ent per pixel (psz) is 1 if t he width bit field in ebi_tftctrl is program m ed t o byte and 2 if t he width bit field is program m ed t o halfword . local fram e base copy fbc get s assigned wit h ebi_tftframebase on every ebi_hsync st obe. fbctrig = vsync: direct drive address for pixel p(x,y) = fbc + (x * psz) direct drive address for pixel p(x,y) = fbc + (x * psz) + (y * ((psz * (hsz + 1)) + hstride)) fbctrig = hsync: note in case that the memory bank used for external direct drive is defined as 16-bit wide, then the direct drive address is internally shifted one bit to the right before being output on the ebi_ad or ebi_a lines. 14.3.17 alpha blending and masking automatic alpha blending and masking can be performed on ahb data written to or via the ebi. alpha blending combines a foreground color with a background color into a new blended color and is further described in section 14.3.17.1 (p. 201 ) . masking is a mechanism to suppress writes matching a specific color. it is used to preserve the background color and is further described in section 14.3.17.2 (p. 202 ) . masking, if enabled, is applied before alpha blending as shown in figure 14.38 (p. 201 ) . masking and alpha blending can be used for both internal and external data transfers.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 201 www.energymicro.com figure 14.38. ebi tft alpha blending and masking ebi_ad ebi_tftmask ebi_tftalpha ebi_tftpixel ebi_tftpixel0 ebi_tftpixel1 mask check alpha blend ebi_ad ahb wdata color1src blend color0 color1 m ask m at ch ext ernal = (maskblend = = emask) or (maskblend = = ealpha) or (maskblend = = emaskealpha) blend = (maskblend = = ialpha) or (maskblend = = ealpha) ext ernal 0 1 0 1 0 1 m ask m at ch 0 1 14.3.17.1 alpha blending automatic alpha blending can be performed on ahb data written to or via the ebi. alpha blending can be enabled for either internal or external writes by setting the maskblend bitfield in the ebi_tftctrl register. internal writes are writes to the internal ebi_tftpixel0 register. external writes are writes to the external device attached to the bank defined in the banksel bitfield of the ebi_tftctrl register. alpha blending works on two data items: a foreground color0 = {r0, g0, b0} and a background color1 = {r1, g1, b1}. these data items are encoded in either 565 rgb or 555 rgb format as defined in the rgbmode bitfield of the ebi_tftctrl register. in case that the 555 rgb format is used, only the 15 least significant bits of color0 and color1 are used for the alpha blending operation itself. the most significant bit of the foreground color0 is passed on unmodified as the most significant bit of the alpha blending result. alpha blending is performed according to formula equation 14.3 (p. 201 ) . ebi alpha blending equation alphablend(color0, color1) = (({r0, g0, b0} x ebi_tftalpha) + ({r1, g1, b1} x (256 - ebi_tftalpha))) / 256 (14.3) the 9-bit alpha blending factor is defined in the ebi_tftalpha register. the maximum allowed value for ebi_tftalpha is 256. an alpha value of 0 corresponds to a fully transparent color, whereas an alpha value of 256 corresponds to a fully opaque color. the rgb color0 data is taken from either the internal write data (written to ebi_tftpixel0) or from the external write data (written to bank banksel). the
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 202 www.energymicro.com color0 source selection is based on the maskblend bitfield of the ebi_tftctrl register. internal write data is used for maskblend settings equal to imask, ialpha, or imaskialpha. external write data is used for maskblend settings equal to emask, ealpha, or emaskealpha. the rgb data for color1 is read from either the banksel memory bank or from the ebi_tftpixel1 register as defined in the color1src bitfield of the ebi_tftctrl register. the alpha blended result will be written to the banksel memory bank for external writes or to the ebi_tftpixel register for internal writes. for transactions involving an external memory device, the automatic transaction translation rules as described in section 14.3.11 (p. 185 ) apply. for example, 1 32-bit wide ahb write to a 16-bit wide external memory can be used to automatically perform 2 16-bit alpha blending operations into external memory. three configurations of data source and destination are supported as described next. in-place alpha blending into external memory is performed by writing rgb data d to address a in bank banksel with color1src set to mem and maskblend set to emask, ealpha, or emaskealpha. note that in this case the ebi automatically translates the ahb write transaction into a read-modify-write sequence for the external memory. ebi in-place alpha blending into external memory memory[a] = alphablend(d, memory[a]) (14.4) alpha blending into external memory with a color1 from register is performed by writing rgb data d to address a in bank banksel with color1src set to pixel1 and maskblend set to emask, ealpha, or emaskealpha: ebi alpha blending into external memory with background color1 from register memory[a] = alphablend(d, ebi_tftpixel1) (14.5) internal alpha blending into register ebi_tftpixel is performed by writing rgb data d to ebi_tftpixel0 with color1src set to pixel1 and maskblend set to imask, ialpha, or imaskealpha. this alpha blending interface is intended for use by both the cortex-m4 and the dma controller. for dma operation three dma requests are generated. one dma request indicating that ebi_tftpixel0 requires new data, one dma request indicating that ebi_tftpixel1 requires new data, and one dma request indicating that new blended data is available in ebi_tftpixel. the write into ebi_tftpixel0 triggers the alpha blending operation. if software wants to reprogram ebi_tftpixel1, then this should be done before the ebi_tftpixel0 write, which triggers the alpha blending. the status of the internal alpha blending interface can also be read via the tftpixel0empty, tftpixel1empty, and tftpixelfull bits in the ebi_status register. ebi internal alpha blending from registers into register ebi_tftpixel = alphablend(ebi_tftpixel0, ebi_tftpixel1) (14.6) 14.3.17.2 masking the masking feature can be used to suppress writes. instead of the write data, the original background color of a pixel is kept. masking is supported for writes to an external device and for writes to internal register ebi_tftpixel0. the 16-bit data value corresponding to the write data to be masked is defined in the ebi_tftmask register. masking is always based on 16-bit data and it does not depend on the rgb mode defined in the rgbmode bitfield of the ebi_tftctrl register. for transactions involving an external memory device, the automatic transaction translation rules as described in section 14.3.11 (p. 185 ) apply. for example, 1 32-bit wide ahb write to a 16-bit wide external memory can be used to perform masking operations on both 16-bit transactions to the external device. masking can for example be used when drawing an icon with rounded corners into an external frame buffer. such an icon can be written to the frame buffer using a 2-dimensional copy action. if the color of a pixel outside the rounded corners is set to match the value defined in the ebi_tftmask register, then such a matching data transfer is suppressed. the resulting image in the frame buffer will keep its original background around the corners of the icon.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 203 www.energymicro.com external masking is enabled by setting the emask bit in the ebi_tftctrl register to 1. if enabled, writes to the memory bank defined in the banksel bitfield of the ebi_tftctrl register are suppressed in case the write data matches the value in ebi_tftmask. internal masking is enabled by setting the imask bit in the ebi_tftctrl register to 1. if enabled and ebi_tftpixel0 is written with data matching ebi_tftmask, then the background color from ebi_tftpixel1 is copied into ebi_tftpixel. if enabled and ebi_tftpixel0 is written with data not matching ebi_tftmask, then the color from ebi_tftpixel0 (possibly alpha blended with ebi_tftpixel1) is written into ebi_tftpixel. the three dma requests and ebi_status bits as described for internal alpha blending also apply for internal masking. 14.3.18 direct drive timing the timing definition for operating a tft display in direct drive mode depends on where the frame buffer source is located. in case internal memory is used as source, then only the tft timing as defined in the ebi_tfttiming register is relevant. in case external memory is used as the source memory, then both the timing parameters of the tft display and the timing parameters of the memory bank defined in the banksel bitfield of the ebi_tftctrl register are relevant. the minimum dot clock, ebi_dclk, period is defined in the dclkperiod bitfield of the ebi_tfttiming register. this parameter has a minimum duration of 1 cycle, which is set by hw, and writing a value n to this bitfield results in an extended duration of 1+n cycles. at cycle 0 (and then periodically with period dclkperiod + 1) the ebi_dclk inactive edges are generated. at the cycle defined in the tftstart bitfield of the ebi_tfttiming the tft direct drive transaction is started. the tftstart bitfield can be used to define the duty cycle of the ebi_dclk. this parameter has a minimum duration of 1 cycle, which is set by hw, and writing a value n to this bitfield results in an extended duration of 1+n cycles. after performing the required actions to produce the required tft pixel data on the ebi_ad lines, the tft transaction will pass through its tftsetup and tfthold states as indicated in figure 14.39 (p. 204 ) . in this figure, the duration of the states in the tft transaction is defined by the corresponding uppercase name above the state and it is expressed in internal clock cycles. the tft setup and hold times are set in the tfthold and tftsetup bitfields in the ebi_tfttiming register. writing a value m to one of these bitfields results in a duration of the corresponding state of m internal clock cycles. if these parameters are set to 0, it effectively means that the state is skipped. the tft setup and hold timing is with respect to the active edge of ebi_dclk as defined in the dclkpol bitfield in the ebi_tftpolarity register. the tft setup and hold timing applies to all tft signals: ebi_ad, ebi_dataen, ebi_vsync, ebi_hsync and ebi_tftcsn. the active ebi_dclk edge is generated in between the tftsetup and tfthold states. the tftstart bitfield therefore impacts the position of the active ebi_dclk edge. the later the tft transaction is started, the later it will transition from its tftsetup to tfthold state. if needed, the ebi_dclk period is automatically stretched beyond the dclkperiod to complete the tft transaction. ebi_dclk period stretching occurs when the tft transaction does not complete in the specified time, which in turn can occur because of the following reasons: ? specified timing parameters are conflicting. this can for example happen if the tft setup plus hold time is programmed to be longer than the ebi_dclk period. ? tft transaction is delayed by an ongoing ebi transaction. this transaction interference can be controlled by setting the transaction interleaving strategy in the interleave bitfield of the ebi_tftctrl register. ? tft transaction data is not delivered in time. for internal direct drive this is caused by the cortex-m4 or dma not delivering the data in time. for external direct drive the timing parameters defining the external device read access might not allow the tft transaction to complete in time. in case the specified dclk_period is not met, the ddjit interrupt flag in the ebi_if register will be set.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 204 www.energymicro.com figure 14.39. ebi tft pixel timing pixel n tftsetup ( 0 , 1 , 2 , ...) dclkperiod ( 1 , 2 , 3 , ...) ebi_ad[ 15:0] ebi_dclk tfthold ( 0 , 1 , 2 , ...) z pixel n+ 1 tftsetup ( 0 , 1 , 2 , ...) tfthold ( 0 , 1 , 2 , ...) dclkperiod ( 1 , 2 , 3 , ...) z z when driving the tft from internal memory, the tft timing is defined in the ebi_tfttiming register as shown in figure 14.40 (p. 204 ) . before each tft transaction to the visible part of the display, the ebi will request new pixel data via an interrupt or dma request. at the time specified in the tftstart bitfield of the ebi_tfttiming register (and when pixel data has been provided), the tft transaction will start. for internal direct drive the tft state machine will place the pixel data on the ebi_ad lines during the tftwdata state after which the state machine will pass through the programmable tftsetup and tfthold states. figure 14.40. ebi tft direct drive internal timing ebi_ad[ 15:0] z data[ 15:0] z tftwdata ( 1 ) ebi_dclk tfthold ( 0 , 1 , 2 , ...) tftsetup ( 0 , 1 , 2 , ...) tftstart ( 1 , 2 , 3 , ...) when the tft is driven directly from an external memory, the timing definitions for the bank defined in the banksel bitfield of the ebi_tftctrl register and those for the tft are both used by direct drive to generate transactions satisfying the requirements of both the memory device and the tft display. the timing definition for the external memory device should be programmed according to its requirements independent of the tft timing. figure 14.41 (p. 204 ) shows an example of the direct drive engine accessing an external memory using the multiplexed 16-bit data, 16-bit address (d16a16ale) mode. the tftsetup and tfthold states are now enclosed within the read transaction states of the chosen mode. the external device read transaction is started at a time as defined by tftstart. the read strobe on ebi_ren is automatically extended in duration to satisfy the tft setup and hold requirements defined in the tftsetup and tfthold bitfields. figure 14.41. ebi tft direct drive external timing addr[ 16:1] ebi_ad[ 15:0] ebi_ale addrsetup ( 1 , 2 , 3 , ...) z data[ 15:0] ebi_csn ebi_ren z rdsetup ( 0 , 1 , 2 , ...) rdstrb ( 1 , 2 , 3 , ...) rdhold ( 0 , 1 , 2 , ...) ebi_dclk tfthold ( 0 , 1 , 2 , ...) tftsetup ( 0 , 1 , 2 , ...) tftstart ( 1 , 2 , 3 , ...) the timing parameters related to the horizontal timing are shown in figure 14.42 (p. 205 ) . these parameters are defined as pixel or ebi_dclk counts. the horizontal porch widths are defined in the hbporch and hfporch bitfields of the ebi_tfthporch register. a porch which has its width parameter programmed to 0 will be skipped. the width and start position of the horizontal synchronization pulse ebi_hsync is programmed via the hsync and hsyncstart bitfields in the ebi_tfthporch register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 205 www.energymicro.com figure 14.42. ebi tft horizontal porch timing ebi_ad[ 15:0] ebi_hsync ebi_dataen ebi_dclk p0 hsz ( 1 , 2 , 3 , ...) horizontal back porch p1 ... ... p hsz horizontal front porch hbporch ( 0 , 1 , 2 , ...) hfporch ( 0 , 1 , 2 , ...) ... ... ... ... ... ... ... ... ... ... ... hsync ( 1 , 2 , 3 , ...) hsyncstart ( 0 , 1 , 2 , ...) the timing parameters related to the vertical timing are shown in figure 14.43 (p. 205 ) . these parameters are defined as line or ebi_hsync counts. the vertical porch widths are defined in the vbporch and vfporch bitfields of the ebi_tftvporch register. a porch which has its width parameter programmed to 0 will be skipped. the width of the vertical synchronization pulse ebi_vsync is programmed via the vsync bitfield in the ebi_tftvporch register. figure 14.43. ebi tft vertical porch timing lines ebi_hsync l0 vsz ( 1 , 2 , 3 , ...) vertical back porch l1 ... l vsz vertical front porch vbporch ( 0 , 1 , 2 , ...) vfporch ( 0 , 1 , 2 , ...) ... ... ... ... ... ... ... ... ebi_vsync vsync ( 1 , 2 , 3 , ...) the active edge of the ebi_dclk and the other tft related signals are by default driven off the positive edge of the internal clock. the edges of the ebi_dclk can also be driven off the negative edge of the internal clock by setting the shiftdclk bitfield in the ebi_tftctrl register to 1. the direct drive engine then shifts the active dclk edge 1/2 an internal cycle into the tfthold state. effectively the length of tftsetup state is increased by 1/2 an internal cycle, whereas the length of the tfthold state is decreased by 1/2 an internal cycle. shiftdclk should not be set if tfthold is set to zero cycles. the effect of the shiftdclk bitfield is shown in figure 14.44 (p. 205 ) and figure 14.45 (p. 205 ) for a setup using the falling ebi_dclk clock as its active edge. figure 14.44. ebi tft pixel timing: ebi_dclk driven off positive edge internal clock ebi_ad[ 15:0] ebi_dclk tfthold ( 0 , 1 , 2 , ...) pixel n tftsetup ( 0 , 1 , 2 , ...) internal clock figure 14.45. ebi tft pixel timing: ebi_dclk driven off negative edge internal clock ebi_ad[ 15:0] ebi_dclk tfthold ( 0 , 1 , 2 , ...) pixel n tftsetup ( 0 , 1 , 2 , ...) internal clock tftsetuphold ( ? + ? )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 206 www.energymicro.com 14.3.19 control signal polarity it is possible to individually configure the control signals to be active high/low by setting or clearing the appropriate bits in the ebi_polarity register. when the its bitfield in the ebi_ctrl register is set to 0, the polarities defined in the ebi_polarity register applies to all 4 memory banks. when its is set to 1 each memory bank uses an individual polarity definition. in this case register ebi_polarity only applies to bank 0. timing for bank n is then defined in the ebi_polarityn register. the tft control signals can also be individually configured to be active high/low by setting or clearing the appropriate bits in the ebi_tftpolarity register. 14.3.20 pin configuration in order to give the ebi access to the external pins of the EFM32WG, the gpio must be configured accordingly. the lines must be set to push-pull, which is described in detail in the gpio section. all the ebi pins are enabled in the ebi_route register. the ebi_ad, ebi_wen and ebi_ren pins are all enabled by the ebipen bit, the ebi_csn pins are enabled by the corresponding csxpen bit, the ebi_ale pin is enabled by the alepen bit , the ebi_bl pins are enabled by the blpen bit, the ebi_nandwen and ebi_nandren pins are enabled by the nandpen bit, the tft pins ebi_dclk, ebi_vsync and ebi_hsync are all enabled by the tftpen bit, the ebi_dataen pin is enabled by the dataenpen bit, the ebi_cstft pin is enabled by the cstftpen bit, the ebi_a pins are enabled by the alb and apen bitfields , and the ebi_ardy pin is enabled by the ardypen bit of the ebi_route register. for some of the ebi pins, alternative pin locations can be chosen by setting the location bitfield in the ebi_route register. these alternative locations are specified in the datasheet. 14.3.21 interrupts the tft controller has 6 separate interrupt flags (vsync, hsync, vbporch, vfporch, ddempty, ddjit) in ebi_if. the vsync, hsync, vbporch, and vfporch interrupt flags indicate various synchronization points during the display of a frame. figure 14.46 (p. 207 ) shows the timing of the vsync, hsync, vbporch, and vfporch interrupt flags. the vsync and hsync flags are set at the beginning of a frame and at the beginning of a line respectively. the vbporch and vfporch flags are set at the end of the vertical back porch and at the beginning of the vertical front porch respectively (provided that the related porch is defined with a non-zero width).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 207 www.energymicro.com figure 14.46. ebi tft interrupts visible display hsz+ 1 hfporch hbporch vsz+ 1 vfporch vbporch vsync, hsync hsync hsync hsync ... ... vbporch hsync ... ... hsync hsync ... ... ... ... vfporch, hsync the ddempty interrupt flag indicates that the ebi_tftdd register is empty during direct drive from internal memory. the ddjit interrupt flag indicates that the dclkperiod is not met during direct drive operation. setting one of the interrupt flags will result in an ebi interrupt if the corresponding interrupt enable bit is set in the ebi_ien register. all generated interrupts from the ebi will activate the same interrupt vector when enabled. 14.3.22 dma request in internal direct drive mode, when the dd bitfield in ebi_tftctrl register is internal, the tft controller sends out a dma request when the pixel buffer ebi_tftdd is empty and needs to be filled. this request is initially set and it is cleared when ebi_tftdd is written. it is set again once the pixel data has been transferred to the display. one dma request is generated for each visible pixel. the masking and alpha blending hardware uses three dma requests related to the status of thee internal masking and alpha blending registers ebi_tftpixel0, ebi_tftpixel1, and ebi_tftpixel. the dma request for ebi_tftpixel0 indicates that new data can be written to be used for internal masking or alpha blending. this request is initially set and it is cleared when ebi_tftpixel0 is written. the request is set again when ebi_tftpixel is read. the dma request for ebi_tftpixel1 is initially set and it is cleared when ebi_tftpixel1 is written. only when both ebi_tftpixel0 and ebi_tftpixel1 have been written, will a ebi_tftpixel read set the dma request for ebi_tftpixel1 again. the dma request for ebi_tftpixel indicates whether new masked and/or blended data is available for reading in ebi_tftpixel or not. it is set after completion of internal masking and alpha blending in reaction to a write to ebi_tftpixel0. it is cleared when ebi_tftpixel is read.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 208 www.energymicro.com 14.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 ebi_ctrl rw control register 0x004 ebi_addrtiming rw address timing register 0x008 ebi_rdtiming rw read timing register 0x00c ebi_wrtiming rw write timing register 0x010 ebi_polarity rw polarity register 0x014 ebi_route rw i/o routing register 0x018 ebi_addrtiming1 rw address timing register 1 0x01c ebi_rdtiming1 rw read timing register 1 0x020 ebi_wrtiming1 rw write timing register 1 0x024 ebi_polarity1 rw polarity register 1 0x028 ebi_addrtiming2 rw address timing register 2 0x02c ebi_rdtiming2 rw read timing register 2 0x030 ebi_wrtiming2 rw write timing register 2 0x034 ebi_polarity2 rw polarity register 2 0x038 ebi_addrtiming3 rw address timing register 3 0x03c ebi_rdtiming3 rw read timing register 3 0x040 ebi_wrtiming3 rw write timing register 3 0x044 ebi_polarity3 rw polarity register 3 0x048 ebi_pagectrl rw page control register 0x04c ebi_nandctrl rw nand control register 0x050 ebi_cmd w1 command register 0x054 ebi_status r status register 0x058 ebi_eccparity r ecc parity register 0x05c ebi_tftctrl rw tft control register 0x060 ebi_tftstatus r tft status register 0x064 ebi_tftframebase rw tft frame base register 0x068 ebi_tftstride rw tft stride register 0x06c ebi_tftsize rw tft size register 0x070 ebi_tfthporch rw tft horizontal porch register 0x074 ebi_tftvporch rw tft vertical porch register 0x078 ebi_tfttiming rw tft timing register 0x07c ebi_tftpolarity rw tft polarity register 0x080 ebi_tftdd rw tft direct drive data register 0x084 ebi_tftalpha rw tft alpha blending register 0x088 ebi_tftpixel0 rw tft pixel 0 register 0x08c ebi_tftpixel1 rw tft pixel 1 register 0x090 ebi_tftpixel r tft alpha blending result pixel register 0x094 ebi_tftmask rw tft masking register 0x098 ebi_if r interrupt flag register 0x09c ebi_ifs w1 interrupt flag set register
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 209 www.energymicro.com offset name type description 0x0a0 ebi_ifc w1 interrupt flag clear register 0x0a4 ebi_ien rw interrupt enable register 14.5 register description 14.5.1 ebi_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name altmap its bl3 bl2 bl1 bl ardyto3dis ardy3en ardyto2dis ardy2en ardyto1dis ardy1en ardytodis ardyen noidle3 noidle2 noidle1 noidle bank3en bank2en bank1en bank0en mode3 mode2 mode1 mode bit name reset access description 31 altmap 0 rw alternative address map enable this field enables or disables the alternative (256 mb per bank) address map. 30 its 0 rw individual timing set, line polarity and mode definition enable this field enables or disables individual timing sets, line polarities and modes per bank. 29:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27 bl3 0 rw byte lane enable for bank 3 enables or disables the byte lane functionality for bank 3. ignored when its = 0. 26 bl2 0 rw byte lane enable for bank 2 enables or disables the byte lane functionality for bank 2. ignored when its = 0. 25 bl1 0 rw byte lane enable for bank 1 enables or disables the byte lane functionality for bank 1. ignored when its = 0. 24 bl 0 rw byte lane enable for bank 0 enables or disables the byte lane functionality for bank 0. applies to all banks when its = 0. applies to only bank 0 when its = 1. 23 ardyto3dis 0 rw ardy timeout disable for bank 3 enables or disables the ardy timeout functionality for bank 3. the timeout value is 32 internal clock cycles. ignored when its = 0. 22 ardy3en 0 rw ardy enable for bank 3 enables or disables the ardy functionality for bank 3. ignored when its = 0. 21 ardyto2dis 0 rw ardy timeout disable for bank 2 enables or disables the ardy timeout functionality for bank 2. the timeout value is 32 internal clock cycles. ignored when its = 0. 20 ardy2en 0 rw ardy enable for bank 2 enables or disables the ardy functionality for bank 2. ignored when its = 0. 19 ardyto1dis 0 rw ardy timeout disable for bank 1 enables or disables the ardy timeout functionality for bank 1. the timeout value is 32 internal clock cycles. ignored when its = 0. 18 ardy1en 0 rw ardy enable for bank 1 enables or disables the ardy functionality for bank 1. ignored when its = 0. 17 ardytodis 0 rw ardy timeout disable enables or disables the ardy timeout functionality. the timeout value is 32 internal clock cycles. applies to all banks when its = 0. applies to only bank 0 when its = 1. 16 ardyen 0 rw ardy enable enables or disables the ardy functionality. applies to all banks when its = 0. applies to only bank 0 when its = 1.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 210 www.energymicro.com bit name reset access description 15 noidle3 0 rw no idle cycle insertion on bank 3. enables or disables idle state insertion between transfers for bank 3. ignored when its = 0. 14 noidle2 0 rw no idle cycle insertion on bank 2. enables or disables idle state insertion between transfers for bank 2. ignored when its = 0. 13 noidle1 0 rw no idle cycle insertion on bank 1. enables or disables idle state insertion between transfers for bank 1. ignored when its = 0. 12 noidle 0 rw no idle cycle insertion on bank 0. enables or disables idle state insertion between transfers for bank 0. applies to all banks when its = 0. applies to only bank 0 when its = 1. 11 bank3en 0 rw bank 3 enable this field enables or disables bank 3. 10 bank2en 0 rw bank 2 enable this field enables or disables bank 2. 9 bank1en 0 rw bank 1 enable this field enables or disables bank 1. 8 bank0en 0 rw bank 0 enable this field enables or disables bank 0. 7:6 mode3 0x0 rw mode 3 this field sets the access mode the ebi will use for interfacing devices on bank 3. ignored when its = 0. value mode description 0 d8a8 ebi_ad drives 8 bit data, 8 bit address, ale not used. extended address bits can be enabled on ebi_a in the ebi_route register. 1 d16a16ale ebi_ad drives 16 bit data, 16 bit address, ale is used for address latching. extended address bits can be enabled on ebi_a in the ebi_route register. 2 d8a24ale ebi_ad drives 8 bit data, 24 bit address, ale is used for address latching. extended address bits can be enabled on ebi_a in the ebi_route register. 3 d16 ebi_ad drives 16 bit data, ale not used. extended address bits can be enabled on ebi_a in the ebi_route register. 5:4 mode2 0x0 rw mode 2 this field sets the access mode the ebi will use for interfacing devices on bank 2. ignored when its = 0. value mode description 0 d8a8 ebi_ad drives 8 bit data, 8 bit address, ale not used. extended address bits can be enabled on ebi_a in the ebi_route register. 1 d16a16ale ebi_ad drives 16 bit data, 16 bit address, ale is used for address latching. extended address bits can be enabled on ebi_a in the ebi_route register. 2 d8a24ale ebi_ad drives 8 bit data, 24 bit address, ale is used for address latching. extended address bits can be enabled on ebi_a in the ebi_route register. 3 d16 ebi_ad drives 16 bit data, ale not used. extended address bits can be enabled on ebi_a in the ebi_route register. 3:2 mode1 0x0 rw mode 1 this field sets the access mode the ebi will use for interfacing devices on bank 1. ignored when its = 0. value mode description 0 d8a8 ebi_ad drives 8 bit data, 8 bit address, ale not used. extended address bits can be enabled on ebi_a in the ebi_route register. 1 d16a16ale ebi_ad drives 16 bit data, 16 bit address, ale is used for address latching. extended address bits can be enabled on ebi_a in the ebi_route register. 2 d8a24ale ebi_ad drives 8 bit data, 24 bit address, ale is used for address latching. extended address bits can be enabled on ebi_a in the ebi_route register. 3 d16 ebi_ad drives 16 bit data, ale not used. extended address bits can be enabled on ebi_a in the ebi_route register. 1:0 mode 0x0 rw mode this field sets the access mode the ebi will use for interfacing devices. applies to all banks when its = 0. applies to only bank 0 when its = 1.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 211 www.energymicro.com bit name reset access description value mode description 0 d8a8 ebi_ad drives 8 bit data, 8 bit address, ale not used. extended address bits can be enabled on ebi_a in the ebi_route register. 1 d16a16ale ebi_ad drives 16 bit data, 16 bit address, ale is used for address latching. extended address bits can be enabled on ebi_a in the ebi_route register. 2 d8a24ale ebi_ad drives 8 bit data, 24 bit address, ale is used for address latching. extended address bits can be enabled on ebi_a in the ebi_route register. 3 d16 ebi_ad drives 16 bit data, ale not used. extended address bits can be enabled on ebi_a in the ebi_route register. 14.5.2 ebi_addrtiming - address timing register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x3 0x3 access rw rw rw name halfale addrhold addrsetup bit name reset access description 31:29 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 28 halfale 0 rw half cycle ale strobe duration enable enables or disables half cycle duration of the ale strobe in the last addrsetup cycle. 27:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:8 addrhold 0x3 rw address hold time sets the number of cycles the address is held after ale is asserted. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 addrsetup 0x3 rw address setup time sets the number of cycles the address is driven onto the addrdat bus before ale is asserted. if set to 0, 1 cycle is inserted by hw. 14.5.3 ebi_rdtiming - read timing register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0x3 0x3f 0x3 access rw rw rw rw rw rw name pagemode prefetch halfre rdhold rdstrb rdsetup bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30 pagemode 0 rw page mode access enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 212 www.energymicro.com bit name reset access description enables or disables page mode reads. 29 prefetch 0 rw prefetch enable enables or disables prefetching of data from sequential address. 28 halfre 0 rw half cycle ren strobe duration enable enables or disables half cycle duration of the ren strobe in the last rdstrb cycle. 27:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 rdhold 0x3 rw read hold time sets the number of cycles csn is held active after the ren is deasserted. this interval is used for bus turnaround. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 rdstrb 0x3f rw read strobe time sets the number of cycles the ren is held active. after the specified number of cycles, data is read. if set to 0, 1 cycle is inserted by hw. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 rdsetup 0x3 rw read setup time sets the number of cycles the address setup before ren is asserted. 14.5.4 ebi_wrtiming - write timing register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x3 0x3f 0x3 access rw rw rw rw rw name wbufdis halfwe wrhold wrstrb wrsetup bit name reset access description 31:30 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 29 wbufdis 0 rw write buffer disable enables or disables the write buffer. 28 halfwe 0 rw half cycle wen strobe duration enable enables or disables half cycle duration of the wen strobe in the last wrstrb cycle. 27:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 wrhold 0x3 rw write hold time sets the number of cycles csn is held active after the wen is deasserted. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 wrstrb 0x3f rw write strobe time sets the number of cycles the wen is held active. if set to 0, 1 cycle is inserted by hw. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 wrsetup 0x3 rw write setup time sets the number of cycles the address setup before wen is asserted.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 213 www.energymicro.com 14.5.5 ebi_polarity - polarity register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name blpol ardypol alepol wepol repol cspol bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 blpol 0 rw bl polarity sets the polarity of the ebi_bln lines. value mode description 0 activelow bln[1:0] are active low. 1 activehigh bln[1:0] are active high. 4 ardypol 0 rw ardy polarity sets the polarity of the ebi_ardy line. value mode description 0 activelow ardy is active low. 1 activehigh ardy is active high. 3 alepol 0 rw address latch polarity sets the polarity of the ebi_ale line. value mode description 0 activelow ale is active low. 1 activehigh ale is active high. 2 wepol 0 rw write enable polarity sets the polarity of the ebi_wen and ebi_nandwen lines. value mode description 0 activelow wen and nandwen are active low. 1 activehigh wen and nandwen are active high. 1 repol 0 rw read enable polarity sets the polarity of the ebi_ren and ebi_nandren lines. value mode description 0 activelow ren and nandren are active low. 1 activehigh ren and nandren are active high. 0 cspol 0 rw chip select polarity sets the polarity of the ebi_csn line. value mode description 0 activelow csn is active low. 1 activehigh csn is active high.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 214 www.energymicro.com 14.5.6 ebi_route - i/o routing register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0x00 0x0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name location cstftpen dataenpen tftpen apen alb nandpen blpen ardypen alepen cs3pen cs2pen cs1pen cs0pen ebipen bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:28 location 0x0 rw i/o location decides the location of the ebi i/o pins. value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26 cstftpen 0 rw ebi_cstft pin enable when set, the ebi_cstft pin is enabled 25 dataenpen 0 rw ebi_tft pin enable when set, the ebi_dataen pin is enabled 24 tftpen 0 rw ebi_tft pin enable when set, the ebi_dclk, ebi_vsync and ebi_hsync pins are enabled 23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22:18 apen 0x00 rw ebi_a pin enable selects which non-multiplexed address lines are enabled on ebi_a. the lower bound l is set to 0, 8, 16 or 24 as defined in the alb field. value mode description 0 a0 all ebi_a pins are disabled. 5 a5 ebi_a[4:l] pins enabled. 6 a6 ebi_a[5:l] pins enabled. 7 a7 ebi_a[6:l] pins enabled. 8 a8 ebi_a[7:l] pins enabled. 9 a9 ebi_a[8:l] pins enabled. 10 a10 ebi_a[9:l] pins enabled. 11 a11 ebi_a[10:l] pins enabled. 12 a12 ebi_a[11:l] pins enabled. 13 a13 ebi_a[12:l] pins enabled. 14 a14 ebi_a[13:l] pins enabled. 15 a15 ebi_a[14:l] pins enabled. 16 a16 ebi_a[15:l] pins enabled. 17 a17 ebi_a[16:l] pins enabled. 18 a18 ebi_a[17:l] pins enabled. 19 a19 ebi_a[18:l] pins enabled. 20 a20 ebi_a[19:l] pins enabled. 21 a21 ebi_a[20:l] pins enabled. 22 a22 ebi_a[21:l] pins enabled. 23 a23 ebi_a[22:l] pins enabled. 24 a24 ebi_a[23:l] pins enabled.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 215 www.energymicro.com bit name reset access description value mode description 25 a25 ebi_a[24:l] pins enabled. 26 a26 ebi_a[25:l] pins enabled. 27 a27 ebi_a[26:l] pins enabled. 28 a28 ebi_a[27:l] pins enabled. 17:16 alb 0x0 rw sets the lower bound for ebi_a enabling sets the lower bound of the ebi_a lines which can be enabled in the apen field. value mode description 0 a0 address lines from ebi_a[0] and upwards can be enabled via apen. 1 a8 address lines from ebi_a[8] and upwards can be enabled via apen. 2 a16 address lines from ebi_a[16] and upwards can be enabled via apen. 3 a24 address lines from ebi_a[24] and upwards can be enabled via apen. 15:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 nandpen 0 rw nandre and nandwe pin enable when set, the nandren and nandwen pin pins are enabled 11:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 blpen 0 rw ebi_bl[1:0] pin enable when set, the ebi_bl[1:0] pins are enabled 6 ardypen 0 rw ebi_ardy pin enable when set, the ebi_ardy pin is enabled 5 alepen 0 rw ebi_ale pin enable when set, the ebi_ale pin is enabled 4 cs3pen 0 rw ebi_cs3 pin enable when set, the ebi_cs3 pin is enabled 3 cs2pen 0 rw ebi_cs2 pin enable when set, the ebi_cs2 pin is enabled 2 cs1pen 0 rw ebi_cs1 pin enable when set, the ebi_cs1 pin is enabled 1 cs0pen 0 rw ebi_cs0 pin enable when set, the ebi_cs0 pin is enabled 0 ebipen 0 rw ebi pin enable when set, the ebi_ad[15:0], ebi_wen and ebi_ren pins are enabled 14.5.7 ebi_addrtiming1 - address timing register 1 offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x3 0x3 access rw rw rw name halfale addrhold addrsetup bit name reset access description 31:29 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 28 halfale 0 rw half cycle ale strobe duration enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 216 www.energymicro.com bit name reset access description enables or disables half cycle duration of the ale strobe in the last address setup cycle. 27:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:8 addrhold 0x3 rw address hold time sets the number of cycles the address is held after ale is asserted. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 addrsetup 0x3 rw address setup time sets the number of cycles the address is driven onto the addrdat bus before ale is asserted. if set to 0, 1 cycle is inserted by hw. 14.5.8 ebi_rdtiming1 - read timing register 1 offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0x3 0x3f 0x3 access rw rw rw rw rw rw name pagemode prefetch halfre rdhold rdstrb rdsetup bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30 pagemode 0 rw page mode access enable enables or disables page mode reads. 29 prefetch 0 rw prefetch enable enables or disables prefetching of data from sequential address. 28 halfre 0 rw half cycle ren strobe duration enable enables or disables half cycle duration of the ren strobe in the last rdstrb cycle. 27:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 rdhold 0x3 rw read hold time sets the number of cycles csn is held active after the ren is deasserted. this interval is used for bus turnaround. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 rdstrb 0x3f rw read strobe time sets the number of cycles the ren is held active. after the specified number of cycles, data is read. if set to 0, 1 cycle is inserted by hw. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 rdsetup 0x3 rw read setup time sets the number of cycles the address setup before ren is asserted.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 217 www.energymicro.com 14.5.9 ebi_wrtiming1 - write timing register 1 offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x3 0x3f 0x3 access rw rw rw rw rw name wbufdis halfwe wrhold wrstrb wrsetup bit name reset access description 31:30 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 29 wbufdis 0 rw write buffer disable enables or disables the write buffer. 28 halfwe 0 rw half cycle wen strobe duration enable enables or disables half cycle duration of the wen strobe in the last wrstrb cycle. 27:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 wrhold 0x3 rw write hold time sets the number of cycles csn is held active after the wen is deasserted. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 wrstrb 0x3f rw write strobe time sets the number of cycles the wen is held active. if set to 0, 1 cycle is inserted by hw. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 wrsetup 0x3 rw write setup time sets the number of cycles the address setup before wen is asserted. 14.5.10 ebi_polarity1 - polarity register 1 offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name blpol ardypol alepol wepol repol cspol bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 blpol 0 rw bl polarity sets the polarity of the ebi_bln lines. value mode description 0 activelow bln[1:0] are active low. 1 activehigh bln[1:0] are active high. 4 ardypol 0 rw ardy polarity
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 218 www.energymicro.com bit name reset access description sets the polarity of the ebi_ardy line. value mode description 0 activelow ardy is active low. 1 activehigh ardy is active high. 3 alepol 0 rw address latch polarity sets the polarity of the ebi_ale line. value mode description 0 activelow ale is active low. 1 activehigh ale is active high. 2 wepol 0 rw write enable polarity sets the polarity of the ebi_wen and ebi_nandwen lines. value mode description 0 activelow wen and nandwen are active low. 1 activehigh wen and nandwen are active high. 1 repol 0 rw read enable polarity sets the polarity of the ebi_ren and ebi_nandren lines. value mode description 0 activelow ren and nandren are active low. 1 activehigh ren and nandren are active high. 0 cspol 0 rw chip select polarity sets the polarity of the ebi_csn line. value mode description 0 activelow csn is active low. 1 activehigh csn is active high. 14.5.11 ebi_addrtiming2 - address timing register 2 offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x3 0x3 access rw rw rw name halfale addrhold addrsetup bit name reset access description 31:29 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 28 halfale 0 rw half cycle ale strobe duration enable enables or disables half cycle duration of the ale strobe in the last address setup cycle. 27:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:8 addrhold 0x3 rw address hold time sets the number of cycles the address is held after ale is asserted. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 addrsetup 0x3 rw address setup time sets the number of cycles the address is driven onto the addrdat bus before ale is asserted. if set to 0, 1 cycle is inserted by hw.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 219 www.energymicro.com 14.5.12 ebi_rdtiming2 - read timing register 2 offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0x3 0x3f 0x3 access rw rw rw rw rw rw name pagemode prefetch halfre rdhold rdstrb rdsetup bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30 pagemode 0 rw page mode access enable enables or disables page mode reads. 29 prefetch 0 rw prefetch enable enables or disables prefetching of data from sequential address. 28 halfre 0 rw half cycle ren strobe duration enable enables or disables half cycle duration of the ren strobe in the last rdstrb cycle. 27:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 rdhold 0x3 rw read hold time sets the number of cycles csn is held active after the ren is deasserted. this interval is used for bus turnaround. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 rdstrb 0x3f rw read strobe time sets the number of cycles the ren is held active. after the specified number of cycles, data is read. if set to 0, 1 cycle is inserted by hw. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 rdsetup 0x3 rw read setup time sets the number of cycles the address setup before ren is asserted. 14.5.13 ebi_wrtiming2 - write timing register 2 offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x3 0x3f 0x3 access rw rw rw rw rw name wbufdis halfwe wrhold wrstrb wrsetup bit name reset access description 31:30 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 29 wbufdis 0 rw write buffer disable enables or disables the write buffer. 28 halfwe 0 rw half cycle wen strobe duration enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 220 www.energymicro.com bit name reset access description enables or disables half cycle duration of the wen strobe in the last wrstrb cycle. 27:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 wrhold 0x3 rw write hold time sets the number of cycles csn is held active after the wen is deasserted. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 wrstrb 0x3f rw write strobe time sets the number of cycles the wen is held active. if set to 0, 1 cycle is inserted by hw. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 wrsetup 0x3 rw write setup time sets the number of cycles the address setup before wen is asserted. 14.5.14 ebi_polarity2 - polarity register 2 offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name blpol ardypol alepol wepol repol cspol bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 blpol 0 rw bl polarity sets the polarity of the ebi_bln lines. value mode description 0 activelow bln[1:0] are active low. 1 activehigh bln[1:0] are active high. 4 ardypol 0 rw ardy polarity sets the polarity of the ebi_ardy line. value mode description 0 activelow ardy is active low. 1 activehigh ardy is active high. 3 alepol 0 rw address latch polarity sets the polarity of the ebi_ale line. value mode description 0 activelow ale is active low. 1 activehigh ale is active high. 2 wepol 0 rw write enable polarity sets the polarity of the ebi_wen and ebi_nandwen lines. value mode description 0 activelow wen and nandwen are active low. 1 activehigh wen and nandwen are active high. 1 repol 0 rw read enable polarity sets the polarity of the ebi_ren and ebi_nandren lines.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 221 www.energymicro.com bit name reset access description value mode description 0 activelow ren and nandren are active low. 1 activehigh ren and nandren are active high. 0 cspol 0 rw chip select polarity sets the polarity of the ebi_csn line. value mode description 0 activelow csn is active low. 1 activehigh csn is active high. 14.5.15 ebi_addrtiming3 - address timing register 3 offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x3 0x3 access rw rw rw name halfale addrhold addrsetup bit name reset access description 31:29 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 28 halfale 0 rw half cycle ale strobe duration enable enables or disables half cycle duration of the ale strobe in the last address setup cycle. 27:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:8 addrhold 0x3 rw address hold time sets the number of cycles the address is held after ale is asserted. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 addrsetup 0x3 rw address setup time sets the number of cycles the address is driven onto the addrdat bus before ale is asserted. if set to 0, 1 cycle is inserted by hw. 14.5.16 ebi_rdtiming3 - read timing register 3 offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0x3 0x3f 0x3 access rw rw rw rw rw rw name pagemode prefetch halfre rdhold rdstrb rdsetup bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 222 www.energymicro.com bit name reset access description 30 pagemode 0 rw page mode access enable enables or disables page mode reads. 29 prefetch 0 rw prefetch enable enables or disables prefetching of data from sequential address. 28 halfre 0 rw half cycle ren strobe duration enable enables or disables half cycle duration of the ren strobe in the last rdstrb cycle. 27:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 rdhold 0x3 rw read hold time sets the number of cycles csn is held active after the ren is deasserted. this interval is used for bus turnaround. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 rdstrb 0x3f rw read strobe time sets the number of cycles the ren is held active. after the specified number of cycles, data is read. if set to 0, 1 cycle is inserted by hw. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 rdsetup 0x3 rw read setup time sets the number of cycles the address setup before ren is asserted. 14.5.17 ebi_wrtiming3 - write timing register 3 offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x3 0x3f 0x3 access rw rw rw rw rw name wbufdis halfwe wrhold wrstrb wrsetup bit name reset access description 31:30 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 29 wbufdis 0 rw write buffer disable enables or disables the write buffer. 28 halfwe 0 rw half cycle wen strobe duration enable enables or disables half cycle duration of the wen strobe in the last wrstrb cycle. 27:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 wrhold 0x3 rw write hold time sets the number of cycles csn is held active after the wen is deasserted. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 wrstrb 0x3f rw write strobe time sets the number of cycles the wen is held active. if set to 0, 1 cycle is inserted by hw. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 wrsetup 0x3 rw write setup time sets the number of cycles the address setup before wen is asserted.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 223 www.energymicro.com 14.5.18 ebi_polarity3 - polarity register 3 offset bit position 0x044 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name blpol ardypol alepol wepol repol cspol bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 blpol 0 rw bl polarity sets the polarity of the ebi_bln lines. value mode description 0 activelow bln[1:0] are active low. 1 activehigh bln[1:0] are active high. 4 ardypol 0 rw ardy polarity sets the polarity of the ebi_ardy line. value mode description 0 activelow ardy is active low. 1 activehigh ardy is active high. 3 alepol 0 rw address latch polarity sets the polarity of the ebi_ale line. value mode description 0 activelow ale is active low. 1 activehigh ale is active high. 2 wepol 0 rw write enable polarity sets the polarity of the ebi_wen and ebi_nandwen lines. value mode description 0 activelow wen and nandwen are active low. 1 activehigh wen and nandwen are active high. 1 repol 0 rw read enable polarity sets the polarity of the ebi_ren and ebi_nandren lines. value mode description 0 activelow ren and nandren are active low. 1 activehigh ren and nandren are active high. 0 cspol 0 rw chip select polarity sets the polarity of the ebi_csn line. value mode description 0 activelow csn is active low. 1 activehigh csn is active high.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 224 www.energymicro.com 14.5.19 ebi_pagectrl - page control register offset bit position 0x048 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x7 0 0x0 access rw rw rw rw name keepopen rdpa inchit pagelen bit name reset access description 31:27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26:20 keepopen 0x00 rw maximum page open time. sets the maximum number of consecutive cycles a page can be considered open. needs to be larger than 0 in order to be able to benefit from rdpa timing. 19:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 rdpa 0x7 rw page read access time sets the number of cycles needed for intrapage page access time. if set to 0, 1 cycle is inserted by hw. 7:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 inchit 0 rw intrapage hit only on incremental addresses sets whether page hits occur on any member in a page or only on incremental addresses. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 pagelen 0x0 rw page length sets the page length. value mode description 0 member4 4 members in a page. 1 member8 8 members in a page. 2 member16 16 members in a page. 3 member32 32 members in a page. 14.5.20 ebi_nandctrl - nand control register offset bit position 0x04c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 access rw rw name banksel en bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:4 banksel 0x0 rw nand flash bank this field sets the memory bank which is connected to a nand flash device value mode description 0 bank0 memory bank 0 is connected to a nand flash device. 1 bank1 memory bank 1 is connected to a nand flash device.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 225 www.energymicro.com bit name reset access description value mode description 2 bank2 memory bank 2 is connected to a nand flash device. 3 bank3 memory bank 3 is connected to a nand flash device. 3:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 en 0 rw nand flash control enable this field enables nand flash control for the memory bank defined in bank. 14.5.21 ebi_cmd - command register offset bit position 0x050 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access w1 w1 w1 name eccclear eccstop eccstart bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 eccclear 0 w1 error correction code clear write to 1 to clear eccparity. 1 eccstop 0 w1 error correction code generation stop write to 1 to stop ecc generation. 0 eccstart 0 w1 error correction code generation start write to 1 to start ecc generation. 14.5.22 ebi_status - status register offset bit position 0x054 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 access r r r r r r r name tftddempty ddact tftpixelfull tftpixel1empty tftpixel0empty eccact ahbact bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13 tftddempty 0 r ebi_tftdd register is empty. indicates that ebi_tftdd register is empty. 12 ddact 0 r ebi busy with direct drive transactions. indicates that ebi is busy with direct drive transactions. 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 tftpixelfull 0 r ebi_tftpixel0 is full.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 226 www.energymicro.com bit name reset access description indicates that ebi_tftpixel is full. 9 tftpixel1empty 0 r ebi_tftpixel1 is empty. indicates that ebi_tftpixel1 is empty. 8 tftpixel0empty 0 r ebi_tftpixel0 is empty. indicates that ebi_tftpixel0 is empty. 7:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 eccact 0 r ebi ecc generation active. indicates that ebi is generating ecc. 3:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 ahbact 0 r ebi busy with ahb transaction. indicates that ebi is busy with an ahb transaction. 14.5.23 ebi_eccparity - ecc parity register offset bit position 0x058 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access r name eccparity bit name reset access description 31:0 eccparity 0x00000000 r ecc parity data ecc parity data. 14.5.24 ebi_tftctrl - tft control register offset bit position 0x05c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 0 0 0x0 0 0 0x0 0x0 access rw rw rw rw rw rw rw rw rw name rgbmode banksel width color1src interleave fbctrig shiftdclken maskblend dd bit name reset access description 31:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24 rgbmode 0 rw tft rgb mode this field sets tft rgb mode.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 227 www.energymicro.com bit name reset access description value mode description 0 rgb565 rgb data is 565. 1 rgb555 rgb data is 555. 23:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21:20 banksel 0x0 rw graphics bank this field sets the memory bank containing the frame buffer value mode description 0 bank0 memory bank 0 is used for direct drive, masking, and alpha blending. 1 bank1 memory bank 1 is used for direct drive, masking, and alpha blending. 2 bank2 memory bank 2 is used for direct drive, masking, and alpha blending. 3 bank3 memory bank 3 is used for direct drive, masking, and alpha blending. 19:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 width 0 rw tft transaction width this field sets tft tranaction width. value mode description 0 byte tft data is 8 bit wide. 1 halfword tft data is 16 bit wide. 15:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 color1src 0 rw masking/alpha blending color1 source this field sets the masking/alpha blending color1 source. value mode description 0 mem masking/alpha blending color 1 is read from external memory. 1 pixel1 masking/alpha blending color 1 is read from ebi_tftpixel1. 11:10 interleave 0x0 rw interleave mode this field sets the tft direct drive interleave mode. value mode description 0 unlimited allow unlimited interleaved ebi accesses per ebi_dclk period. this can cause jitter on the ebi_dclk 1 oneperdclk allow 1 interleaved ebi access per ebi_dclk period. 2 porch only allow ebi accesses during tft porches. 9 fbctrig 0 rw tft frame base copy trigger sets the trigger on which the tftframebase is copied into an internal buffer. direct drive address generation is based on the internal buffer. value mode description 0 vsync tftframebase is buffered on the vertical synchronization event ebi_vsync. 1 hsync tftframebase is buffered on the horizontal synchronization event ebi_hsync. 8 shiftdclken 0 rw tft ebi_dclk shift enable when this bit is set, ebi_dclk edges are driven off the negative (instead of the positive) edge of the internal clock. shiftdclken is only allowed to be set to 1 if tfthold in ebi_tfttiming is at least 1. 7:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4:2 maskblend 0x0 rw tft mask and blend mode this field sets the mask and blend mode. value mode description 0 disabled masking and blending are disabled. 1 imask internal masking is enabled. 2 ialpha internal alpha blending is enabled. 3 imaskialpha internal masking and alpha blending are enabled. 5 emask external masking is enabled. 6 ealpha external alpha blending is enabled.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 228 www.energymicro.com bit name reset access description value mode description 7 emaskealpha external masking and alpha blending are enabled. 1:0 dd 0x0 rw tft direct drive mode this field sets the direct mode. value mode description 0 disabled direct drive is disabled. 1 internal direct drive from internal memory enabled and started. 2 external direct drive from external memory enabled and started. 14.5.25 ebi_tftstatus - tft status register offset bit position 0x060 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 0x000 access r r name vcnt hcnt bit name reset access description 31:27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26:16 vcnt 0x000 r vertical count contains the current line position within a frame (initial line in vertical back porch has vcnt = 0). 15:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:0 hcnt 0x000 r horizontal count contains the current pixel position within a line (initial pixel in horizontal backporch has hcnt = 0). 14.5.26 ebi_tftframebase - tft frame base register offset bit position 0x064 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000000 access rw name framebase bit name reset access description 31:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27:0 framebase 0x0000000 rw frame base address sets the frame base address.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 229 www.energymicro.com 14.5.27 ebi_tftstride - tft stride register offset bit position 0x068 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 access rw name hstride bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:0 hstride 0x000 rw horizontal stride sets the horizontal stride added to the direct drive address at the end of each line. 14.5.28 ebi_tftsize - tft size register offset bit position 0x06c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 0x000 access rw rw name vsz hsz bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:16 vsz 0x000 rw vertical size (excluding porches) sets the vertical size in lines. set to required size minus 1. 15:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:0 hsz 0x000 rw horizontal size (excluding porches) sets the horizontal size in pixels. set to required size minus 1. 14.5.29 ebi_tfthporch - tft horizontal porch register offset bit position 0x070 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x00 0x00 0x00 access rw rw rw rw name hsyncstart hbporch hfporch hsync
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 230 www.energymicro.com bit name reset access description 31:30 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 29:28 hsyncstart 0x0 rw hsync start delay sets the hsync start position into the horizontal back porch in dclk cycles. 27:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:18 hbporch 0x00 rw horizontal back porch size sets the horizontal back porch size in pixels. 17:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:8 hfporch 0x00 rw horizontal front porch size sets the horizontal front porch size in pixels. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:0 hsync 0x00 rw horizontal synchronization pulse width sets the horizontal synchronization pulse width. set to required width minus 1. width is reduced in case hsyncstart > 0. 14.5.30 ebi_tftvporch - tft vertical porch register offset bit position 0x074 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x00 0x00 access rw rw rw name vbporch vfporch vsync bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:18 vbporch 0x00 rw vertical back porch size sets the vertical back porch size in pixels. 17:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:8 vfporch 0x00 rw vertical front porch size sets the vertical front porch size in pixels. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:0 vsync 0x00 rw vertical synchronization pulse width sets the vertical synchronization pulse width. set to required width minus 1.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 231 www.energymicro.com 14.5.31 ebi_tfttiming - tft timing register offset bit position 0x078 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x000 0x000 access rw rw rw rw name tfthold tftsetup tftstart dclkperiod bit name reset access description 31:30 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 29:28 tfthold 0x0 rw tft hold time sets the number of internal clock cycles the rgb data is held after the active edge of ebi_dclk. 27:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:24 tftsetup 0x0 rw tft setup time sets the number of internal clock cycles the rgb data is driven before the active edge of ebi_dclk. 23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22:12 tftstart 0x000 rw tft direct drive transaction start sets the starting position of the external direct drive transaction relative to the dclk inactive edge. 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:0 dclkperiod 0x000 rw tft direct drive transaction (ebi_dclk) period sets the direct drive transaction (ebi_dclk) period in internal cycles. set to required cycle count minus 1. 14.5.32 ebi_tftpolarity - tft polarity register offset bit position 0x07c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 access rw rw rw rw rw name vsyncpol hsyncpol dataenpol dclkpol cspol bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 vsyncpol 0 rw vsync polarity sets the polarity of the ebi_vsync line. value mode description 0 activelow vsync is active low. 1 activehigh vsync is active high. 3 hsyncpol 0 rw address latch polarity sets the polarity of the ebi_hsync line. value mode description 0 activelow hsync is active low.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 232 www.energymicro.com bit name reset access description value mode description 1 activehigh hsync is active high. 2 dataenpol 0 rw tft dataen polarity sets the polarity of the ebi_dataen line. value mode description 0 activelow dataen is active low. 1 activehigh dataen is active high. 1 dclkpol 0 rw tft dclk polarity sets the active edge polarity of the ebi_dclk line. value mode description 0 activefalling dclk falling edge is the active edge. 1 activerising dclk rising edge the active edge. 0 cspol 0 rw tft chip select polarity sets the polarity of the ebi_cstft line. value mode description 0 activelow cstft is active low. 1 activehigh cstft is active high. 14.5.33 ebi_tftdd - tft direct drive data register offset bit position 0x080 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name data bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 data 0x0000 rw tft direct drive data from internal memory sets the rgb value used when direct drive from internal memory is used (dd = internal) 14.5.34 ebi_tftalpha - tft alpha blending register offset bit position 0x084 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 access rw name alpha
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 233 www.energymicro.com bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 alpha 0x000 rw tft alpha blending factor sets the alpha blending factor. the maximum value is 256. 14.5.35 ebi_tftpixel0 - tft pixel 0 register offset bit position 0x088 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name data bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 data 0x0000 rw rgb data. sets the rgb data value according to the format defined in rgbmode. 14.5.36 ebi_tftpixel1 - tft pixel 1 register offset bit position 0x08c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name data bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 data 0x0000 rw rgb data. sets the rgb data value according to the format defined in rgbmode.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 234 www.energymicro.com 14.5.37 ebi_tftpixel - tft alpha blending result pixel register offset bit position 0x090 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access r name data bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 data 0x0000 r alpha blending result rgb result of alpha blending operation according to the format defined in rgbmode. 14.5.38 ebi_tftmask - tft masking register offset bit position 0x094 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name tftmask bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 tftmask 0x0000 rw tft mask value sets the mask value. data write transactions matching this value are suppressed. 14.5.39 ebi_if - interrupt flag register offset bit position 0x098 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access r r r r r r name ddjit ddempty vfporch vbporch hsync vsync
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 235 www.energymicro.com bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ddjit 0 r direct drive jitter interrupt flag set when dclkperiod is not met. 4 ddempty 0 r direct drive data empty interrupt flag set when direct drive engine ebi_tftdd data is empty. 3 vfporch 0 r vertical front porch interrupt flag set at beginning of vertical front porch. 2 vbporch 0 r vertical back porch interrupt flag set at end of vertical back porch. 1 hsync 0 r horizontal sync interrupt flag set at horizontal sync pulse. 0 vsync 0 r vertical sync interrupt flag set at vertical sync pulse. 14.5.40 ebi_ifs - interrupt flag set register offset bit position 0x09c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 name ddjit ddempty vfporch vbporch hsync vsync bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ddjit 0 w1 direct drive jitter interrupt flag set write to 1 to set direct drive jitter interrupt flag. 4 ddempty 0 w1 direct drive data empty interrupt flag set write to 1 to set direct drive data empty interrupt flag. 3 vfporch 0 w1 vertical front porch interrupt flag set write to 1 to set vertical front porch interrupt flag. 2 vbporch 0 w1 vertical back porch interrupt flag set write to 1 to set vertical back porch interrupt flag. 1 hsync 0 w1 horizontal sync interrupt flag set write to 1 to set horizontal sync interrupt flag. 0 vsync 0 w1 vertical sync interrupt flag set write to 1 to set vertical sync interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 236 www.energymicro.com 14.5.41 ebi_ifc - interrupt flag clear register offset bit position 0x0a0 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 name ddjit ddempty vfporch vbporch hsync vsync bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ddjit 0 w1 direct drive jitter interrupt flag clear write to 1 to clear direct drive jitter interrupt flag. 4 ddempty 0 w1 direct drive data empty interrupt flag clear write to 1 to clear direct drive data empty interrupt flag. 3 vfporch 0 w1 vertical front porch interrupt flag clear write to 1 to clear vertical front porch interrupt flag. 2 vbporch 0 w1 vertical back porch interrupt flag clear write to 1 to clear vertical back porch interrupt flag. 1 hsync 0 w1 horizontal sync interrupt flag clear write to 1 to clear horizontal sync interrupt flag. 0 vsync 0 w1 vertical sync interrupt flag clear write to 1 to clear vertical sync interrupt flag. 14.5.42 ebi_ien - interrupt enable register offset bit position 0x0a4 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name ddjit ddempty vfporch vbporch hsync vsync bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ddjit 0 rw direct drive jitter interrupt enable set to enable interrupt on direct drive jitter interrupt flag. 4 ddempty 0 rw direct drive data empty interrupt enable set to enable interrupt on direct drive data empty interrupt flag. 3 vfporch 0 rw vertical front porch interrupt enable set to enable interrupt on beginning of vertical front porch interrupt flag. 2 vbporch 0 rw vertical back porch interrupt enable set to enable interrupt on end of vertical back porch interrupt flag. 1 hsync 0 rw horizontal sync interrupt enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 237 www.energymicro.com bit name reset access description set to enable interrupt on horizontal sync interrupt flag. 0 vsync 0 rw vertical sync interrupt enable set to enable interrupt on vertical sync interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 238 www.energymicro.com 15 usb - universal serial bus controller 0 1 2 3 4 quick facts what? the usb is a full-speed/low-speed usb 2.0 compliant usb controller that can be used in otg dual role device, device and host configurations. the on-chip 3.3v regulator delivers up to 50 ma and can also be used to power external components, eliminating the need for an external ldo. the on-chip regulator allows the system to run from a battery utilizing the full voltage range of the efm32 still being compliant with the 3.3v +/- 10% usb voltage range. why? usb provides a robust, industry-standard way to interface pcs and other portable devices. how? the flexible and highly software-configurable architecture of the usb controller makes it easy to implement both device- and host- capable solutions. the on-chip otg phy with software controllable pull-up and pull- down resistors, vbus comparators and id-line detection reduces the number of external components to a minimum. third- party usb software stacks are also available, reducing the development time substantially. by utilizing the very low energy consumption in em2, the usb device will be able to wake up and perform tasks several times a second without violating the 2.5 ma maximum average current during suspend. 15.1 introduction the usb is a full-speed/low-speed usb 2.0 compliant otg host/device controller. the architecture is very flexible and allows the usb to be used in on-the-go (otg) dual-role device, device and host- only configurations. the usb supports hnp and srp protocols and both otg revisions 1.3 and 2.0 are supported. the on-chip voltage regulator and phy reduces the number of external components to a minimum. a switchable external 5v supply or step-up regulator is needed for otg dual role device and host configurations. 15.2 features ? fully compliant with universal serial bus specification, revision 2.0 ? supports full-speed (12 mbit/s) and low-speed (1.5 mbit/s) host and device ? dedicated internal dma controller ? 12 software-configurable endpoints (6 in, 6 out) in addition to endpoint 0 ? 2 kb endpoint memory
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 239 www.energymicro.com ? resume/reset detection in em2 (during suspend) ? srp detection in em2 (during host session off) ? soft connect/disconnect ? full otg support ? compliant with on-the-go and embedded host supplement to the usb revision 2.0 specification, revision 2.0 ? compliant with usb on-the-go supplement, revision 1.3 ? supports host negotiation protocol (hnp) and session request protocol (srp) ? on-chip phy ? internal pull-up and pull-down resistors ? voltage comparators for monitoring vbus voltage ? a/b device identification using id line ? charge/discharge of vbus for vbus-pulsing ? internal 3.3v regulator ? output voltage: 3.3v ? output current: 50 ma ? input voltage range: 4.0 - 5.5v ? enabled automatically when input voltage applied ? low quiescent current: 100 ua ? dedicated input pin allows regulator to be used in otg and host configurations ? output pin can be used to power the efm32 itself as well as external components ? regulator voltage output sense feature for detecting usb plug/unplug events (also available in em2/3) 15.3 usb system description an block diagram of the usb is shown in figure 15.1 (p. 239 ) . figure 15.1. usb block diagram otg phy usb_vbus volt age regulat or ( 3.3 v) usb_dp usb_dm usb_id usb_vregi usb_vrego ahb mast er ahb slave ahb 2 kb fifo ram usb_vbusen vrego sense usb core w / dma cont roller apb slave apb usb int errupt sof prs usb_dmpu usb syst em ( cont rol) the usb consists of a digital logic part, a 2 kb endpoint ram, otg phy and a voltage regulator with output voltage sensor. the voltage regulator provides a stable 3.3 v supply for the phy, but can also be used to power the efm32 itself as well as external components. the digital logic of the usb is split into two parts: system and core.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 240 www.energymicro.com the system part is accessed using usb registers from offset 0x000 to 0x018 and controls the voltage regulator and enabling/disabling of the phy and usb pins. this part is clocked by hfcoreclk usb and is accessed using an apb slave interface. the system part can thus be accessed independently of the core part, without hfcoreclk usbc running. the core part is clocked by hfcoreclk usbc and is accessed using an ahb slave interface. this interface is used for accessing the fifo contents and the registers in the core part starting at offset 0x3c000. an additional master interface is used by the internal dma controller of the core. the core part takes care of all the usb protocol related functionality. the clock to the system part must not be disabled when the core part is active. there are 8 pins associated with the usb. usb_vbus should be connected to the vbus (5v) pin on the usb receptacle. it is connected to the voltage comparators and current sink/source in the phy. usb_dp and usb_dm are the usb d+ and d- pins. these are the usb data signaling pins. usb_id is the otg id pin used to detect the device type (a or b). this pin can be left unconnected when not used. usb_vregi is the input to the voltage regulator and usb_vrego is the regulated output. usb_vbusen is used to turn on and off vbus power when operating as host-only or otg a-device. usb_dmpu is used to enable/disable an external d- pull-up resistor. this is needed for low-speed device only. usb_vbusen and usb_dmpu will be high-impedance until the pins are enabled from software. thus, if a defined level is required during start-up an external pull-up/pull-down can be used. 15.3.1 usb initialization the usb requires the device to run from a 48 mhz crystal (2500 ppm or better). the core part of the usb will always run from hfcoreclk usbc which is hfclk undivided (48 mhz). the current consumption for the rest of the device can be reduced by dividing down hfcoreclk using the cmu_hfcoreclkdiv register. bandwidth requirements for the specific usb application must be taken into account when dividing down hfcoreclk. follow these steps to enable the usb: 1. enable the clock to the system part by setting usb in cmu_hfcoreclken0. 2. if the internal usb regulator is bypassed (by applying 3.3v on usb_vregi and usb_vrego externally), disable the regulator by setting vregdis in usb_ctrl. 3. if the phy is powered from vbus using the internal regulator, the vrego sense circuit should be enabled by setting vregosen in usb_ctrl. 4. enable the usb phy pins by setting phypen in usb_route. 5. if host or otg dual-role device, set vbusenap in usb_ctrl to the desired value and then enable the usb_vbusen pin in usb_route. set the mode for the pin to pushpull. 6. if low-speed device, set dmpuap in usb_ctrl to the desired value and then enable the usb_dmpu pin in usb_route. set the mode for the pin to pushpull. 7. make sure hfxo is ready and selected. the core part requires the undivided hfclk to be 48 mhz when usb is active (during suspend/session-off a 32 khz clock is used).. 8. enable the clock to the core part by setting usbc in cmu_hfcoreclken0. 9. wait for the core to come out of reset. this is easiest done by polling a core register with non-zero reset value until it reads a non-zero value. this takes approximately 20 48-mhz cycles. 10. start initializing the usb core as described in usb core description. 15.3.2 configurations the usb can be used as device, otg dual role device or host. the sections below describe the different configurations. external esd protection and series resistors for impedance matching are required. the voltage regulator requires a 4.7 uf external decoupling capacitor on the input and a 1 uf external decoupling capacitor on the output. decoupling not related to usb is not shown in the figures.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 241 www.energymicro.com 15.3.2.1 bus-powered device a bus-powered device configuration is shown in figure 15.2 (p. 241 ) . in this configuration the voltage regulator powers the phy and the efm32 at 3.3 v. the voltage regulator output (usb_vrego) can also be used to power other components of the system. in this configuration, the vrego sense circuit should be left disabled. figure 15.2. bus-powered device usb_dp usb_dm st andard b vbus d+ d- gnd usb_vbus efm32 usb_vregi usb_vrego (esd prot ect ion) vdd 15.3.2.2 self-powered device a self-powered device configuration is shown in figure 15.3 (p. 241 ) . when the usb is configured as a self-powered device, the voltage regulator is typically used to power the phy only, although it may also be used to power other 3.3 v components. when the usb is connected to a host, the voltage regulator is activated. software can detect this event by enabling the vrego sense high (vregosh) interrupt. the phy pins can then be enabled and usb traffic can start. the vrego sense low (vregosl) interrupt can be used to detect when vbus voltage disappears (for example if the usb cable is unplugged). in this configuration, the vrego sense circuit must be enabled. figure 15.3. self-powered device usb_dp usb_dm st andard b vbus d+ d- gnd usb_vbus efm32 usb_vregi usb_vrego (esd prot ect ion) vdd 1.8v ? 3.6v
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 242 www.energymicro.com 15.3.2.3 self-powered device (with bus-power switch) a self-powered device (with bus-power switch) may switch power supply to vbus when connected to a host. this is typically useful for extending the life of battery-powered devices and enables the use of coin-cell driven systems with low maximum peak current. the external components required typically include 2 transistors, 2 diodes and a few resistors. see application note for details. this allows seamless power supply switching between a battery and the voltage regulator output. the vrego sense high interrupt is used to detect when vbus becomes present. software can then enable the external transistor connected to usb_vrego, effectively switching the power source. a regular gpio pin is used to control this transistor. if necessary, the application may have to reduce the current consumption before switching to the usb power source. if vbus voltage is removed, the circuit switches automatically back to the battery power supply. if necessary software must react quickly to this event and reduce the current consumption (for example by reducing the clock frequency) to avoid excessive voltage drop. this configuration is shown in figure 15.4 (p. 242 ) . in this configuration, the vrego sense circuit must be enabled. figure 15.4. self-powered device (with bus-power switch) usb_dp usb_dm st andard b vbus d+ d- gnd usb_vbus efm32 usb_vregi usb_vrego (esd prot ect ion) vdd 1.8v ? 3.6v dual- power circuit (enable) gpio 15.3.2.4 otg dual role device (5v) an otg dual role device (5v) configuration is shown in figure 15.5 (p. 243 ) . when 5v is available, the internal regulator can be used to power the efm32. an external power switch is needed to control vbus power. for over-current detection a regular gpio input pin with interrupt is used. the application should turn off or limit vbus power when over-current is detected. in otg mode, the maximum vbus decoupling capacitance is 6.5 uf. in this configuration, the vrego sense circuit should be left disabled.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 243 www.energymicro.com figure 15.5. otg dual role device (5v) usb_dp usb_dm micro-ab vbus d+ d- id usb_vbus efm32 usb_vregi usb_vrego (esd prot ect ion) vdd usb_id gnd 5v usb_vbusen gpio (over-current ) power swit ch + over -current det ect ion v in v out en oc 15.3.2.5 otg dual role device (5v step-up regulator) an otg dual role device (5v step-up regulator) configuration is shown in figure 15.6 (p. 243 ) . when 5v is not available, an external 5v step-up regulator is needed. in this configuration, the voltage for the efm32 must be in the range 3.0v - 3.6v. in this mode the voltage regulator is bypassed by connecting both the input and output to the external supply. this effectively causes the phy to be powered directly from the external 3.0 - 3.6 v supply. the voltage regulator should be disabled when operating in this mode. for over-current detection a regular gpio input pin with interrupt is used. the application should turn off or limit vbus power when over-current is detected. in otg mode, the maximum vbus decoupling capacitance is 6.5 uf. in this configuration, the vrego sense circuit should be left disabled. figure 15.6. otg dual role device (5v step-up regulator) usb_dp usb_dm micro-ab vbus d+ d- id usb_vbus efm32 usb_vrego usb_vregi (esd prot ect ion) vdd usb_id gnd 3.0v ? 3.6v usb_vbusen gpio (over-current ) en v out v in oc 5v st ep-up 15.3.2.6 host a host configuration is shown in figure 15.7 (p. 244 ) . in this example a 5v step-up regulator is used. if 5v is available, a power switch can be used instead, as shown in figure 15.5 (p. 243 ) . the host configuration is equal to otg dual role device, except for the usb_id pin which is not used and the usb connector which is a usb standard-a connector. in host mode, the minimum vbus decoupling capacitance is 96 uf.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 244 www.energymicro.com in this configuration, the vrego sense circuit should be left disabled. figure 15.7. host usb_dp usb_dm st andard a vbus d+ d- usb_vbus efm32 usb_vrego usb_vregi (esd prot ect ion) vdd gnd 3.0v ? 3.6v usb_vbusen gpio (over-current ) en v out v in oc 5v st ep-up 15.3.3 phy the usb includes an internal full-speed/low-speed phy with built-in pull-up/pull-down resistors, vbus comparators and id line state sensing. during suspend, the phy enters a low-power state where only the single-ended receivers are active. the phy is disabled by default and should be enabled by setting phypen in usb_route before the usb core clock is enabled. the phy is powered by the internal voltage regulator output (usb_vrego). to power the phy directly from an external source (for example an external 3.3 v ldo), connect both usb_vrego and usb_vregi to the external 3.3 v supply voltage. to stop the quiescent current present with the voltage regulator enabled in this configuration, disable the the regulator by setting vregdis in usb_ctrl after power up. then the regulator is effectively bypassed. when vrego sense is enabled, the phy is automatically disabled internally when the vrego sense output is low. this will happen if vbus-power disappears. the application can detect this by keeping the vrego sense low interrupt enabled. note that phypen in usb_route will not be set to 0 in this case. 15.3.4 voltage regulator the voltage regulator is used to regulate the 5 v vbus voltage down to 3.3 v which is the operating voltage for the phy. a decoupling capacitor is required on usb_vregi and usb_vrego. note that the usb standard requires the total capacitance on vbus to be 1 uf minimum and 10 uf maximum for regular devices. otg devices can have maximum 6.5 uf capacitance on vbus. the voltage regulator is enabled by default and can thus be used to power the efm32 itself. systems not using the usb should disable the regulator by setting vregdis in usb_ctrl. a voltage sense circuit monitors the output voltage and can be used to detect when the voltage regulator becomes active. this sense circuit can also be used to detect when the voltage drops (typically due to the usb cable being unplugged). if regulator voltage monitoring is not required (i.e. it is known that the vrego voltage is always present), the sense circuit should be left disabled. during suspend, the bias current for the regulator can be reduced if the current requirements in em2/3 are low. the bias current in em2/3 is controlled by biasprogem23 in usb_ctrl. when em2/3 is entered, the bias current for the regulator switches to what is specified in biasprogem23 in usb_ctrl. when
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 245 www.energymicro.com entering em0 again (due to usb resume/reset signaling or any other wake-up interrupt) the regulator switches back to using the value specified in biasprogem01 in usb_ctrl. 15.3.5 interrupts and prs interrupts from the core and system part share a common usb interrupt line to the cpu. the interrupt flags for the system part are grouped together in the usb_if register. the interrupt events from the core are controlled by several core interrupt flag registers. there are two prs outputs from the usb: sof and sofsr. in host mode, sof toggles every time an sof is generated. in device mode, sof toggles every time an sof token is received from the usb host or when an sof token is missed at the start of frame. in host mode, sofsr toggles every time an sof is successfully transmitted. in device mode, sofsr toggles only when a valid sof token is received from the usb host. both prs outputs must be synchronized in the prs when used (i.e. it is an asynchronous prs output). the edge-to-pulse converter in the prs can be used to convert the edges into pulses if needed. the prs outputs go to 0 in em2/3. 15.3.6 usb in em2 during suspend and session-off em2 should be used to save power and meet the average current requirements dictated by the usb standard. before entering em2, hfcoreclk usbc must be switched from 48 mhz to 32 khz (lfxo or lfrco). this is done using the cmu_cmd and cmu_status registers. while hfcoreclk usbc is 32 khz, the usb core registers (starting from offset 0x3c000) cannot be accessed and the the internal dma in the usb core will not be able to access the ahb bus. upon em2 wake-up, hfcoreclk usbc must be switched back to 48 mhz before accessing the core registers. the device always starts up from hfrco so software must restart hfxo and switch from hfrco to hfxo. the usb system clock, hfcoreclk usb , must be kept enabled during em2. the usb system registers can be accessed immediately upon em2 wake-up, while running from hfrco. follow the steps outlined the usb core description when entering em2 during suspend and session-off. the fifo content is lost when entering em2. in addition, most of the usb core registers are reset and therefore need to be backed up in ram. em3 cannot be used when the usb is active. however, em3 can be used while waiting for the internal voltage regulator to be activated (i.e. vbus becomes 5v). 15.4 usb core description this section describes the programming requirements for the usb core in host and device modes. important features/parameters for the core are: ? hnp- and srp-capable otg (device and host) ? internal dma (buffer pointer based) ? dedicated tx fifos for each endpoint in device mode ? 6 in/out endpoints in addition to endpoint 0 (in device mode) ? 14 host channels (in host mode) ? dynamic fifo sizing ? non-periodic request queue depth: 8 ? host mode periodic request queue depth: 8 the core has the following limitations: ? link power management (lpm) is not supported ? adp is not supported portions copyright ? 2010 synopsys, inc. used with permission. synopsys and designware are registered trademarks of synopsys, inc.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 246 www.energymicro.com 15.4.1 overview: programming the core each significant programming feature of the core is discussed in a separate section. this chapter uses abbreviations for register names and their fields. for detailed information on registers, see section 15.6 (p. 349 ) . the application must perform a core initialization sequence. if the cable is connected during power-up, the current mode of operation bit in the core interrupt register (usb_gintsts.curmod) reflects the mode. the core enters host mode when an ?a? plug is connected, or device mode when a ?b? plug is connected. this section explains the initialization of the core after power-on. the application must follow the initialization sequence irrespective of host or device mode operation. all core global registers are initialized according to the core?s configuration. 1. program the following fields in the global ahb configuration (usb_gahbcfg) register. ? dma mode bit ? ahb burst length field ? global interrupt mask bit = 1 ? non-periodic txfifo empty level (can be enabled only when the core is operating in slave mode as a host.) ? periodic txfifo empty level (can be enabled only when the core is operating in slave mode) 2. program the following field in the global interrupt mask (usb_gintmsk) register: ? usb_gintmsk.rxflvlmsk = 0 3. program the following fields in usb_gusbcfg register. ? hnp capable bit ? srp capable bit ? external hs phy or internal fs serial phy selection bit ? time-out calibration field ? usb turnaround time field 4. the software must unmask the following bits in the usb_gintmsk register. ? otg interrupt mask ? mode mismatch interrupt mask 5. the software can read the usb_gintsts.curmod bit to determine whether the core is operating in host or device mode. the software the follows either the section 15.4.1.1 (p. 246 ) or device initialization (p. 247 ) sequence. note the core is designed to be interrupt-driven. polling interrupt mechanism is not recommended: this may result in undefined resolutions. note in device mode, just after power on reset or a soft reset, the usb_gintsts.sof bit is set to 1 for debug purposes. this status must be cleared and can be ignored. 15.4.1.1 host initialization to initialize the core as host, the application must perform the following steps. 1. program usb_gintmsk.prtint to unmask. 2. program the usb_hcfg register to select full-speed host. 3. program the usb_hprt.prtpwr bit to 1. this drives vbus on the usb. 4. wait for the usb_hprt.prtconndet interrupt. this indicates that a device is connect to the port. 5. program the usb_hprt.prtrst bit to 1. this starts the reset process. 6. wait at least 10 ms for the reset process to complete.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 247 www.energymicro.com 7. program the usb_hprt.prtrst bit to 0. 8. wait for the usb_hprt.prtenchng interrupt. 9. read the usb_hprt.prtspd field to get the enumerated speed. 10. program the usb_hfir register with a value corresponding to the selected phy clock. at this point, the host is up and running and the port register begins to report device disconnects, etc. the port is active with sofs occurring down the enabled port. 11. program the rxfsize register to select the size of the receive fifo. 12. program the nptxfsize register to select the size and the start address of the non-periodic transmit fifo for non-periodic transactions. 13. program the usb_hptxfsiz register to select the size and start address of the periodic transmit fifo for periodic transactions. to communicate with devices, the system software must initialize and enable at least one channel as described in device initialization (p. 247 ) . 15.4.1.1.1 host connection the following steps explain the host connection flow: 1. when the usb cable is plugged to the host port, the core triggers usb_gintsts.conidstschng interrupt. 2. when the host application detects usb_gintsts.conidstschng interrupt, the application can perform one of the following actions: ? turn on vbus by setting usb_hprt.prtpwr = 1 or ? wait for srp signaling from device to turn on vbus. 3. the phy indicates vbus power-on by detecting a vbus valid voltage level. 4. when the host core detects the device connection, it triggers the host port interrupt (usb_gintsts.prtint) to the application. 5. when usb_gintsts.prtint is triggered, the application reads the usb_hprt register to check if the port connect detected (usb_hprt.prtconndet) bit is set or not. 15.4.1.1.2 host disconnection the following steps explain the host disconnection flow: 1. when the device is disconnected from the usb cable (but the cable is still connected to the usb host), the core triggers usb_gintsts.disconnint (disconnect detected) interrupt. note if the usb cable is disconnected from the host port without removing the device, the core generates an additional interrupt - usb_gintsts.conidstschng (connector id status change). 2. the host application can choose to turn off the vbus by programming usb_hprt.prtpwr = 0. 15.4.1.2 device initialization the application must perform the following steps to initialize the core at device on, power on, or after a mode change from host to device. 1. program the following fields in usb_dcfg register. ? device speed ? non-zero-length status out handshake ? periodic frame interval 2. program the usb_gintmsk register to unmask the following interrupts. ? usb reset ? enumeration done
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 248 www.energymicro.com ? early suspend ? usb suspend 3. wait for the usb_gintsts.usbrst interrupt, which indicates a reset has been detected on the usb and lasts for about 10 ms. on receiving this interrupt, the application must perform the steps listed in initialization on usb reset (p. 281 ) 4. wait for the usb_gintsts.enumdone interrupt. this interrupt indicates the end of reset on the usb. on receiving this interrupt, the application must read the usb_dsts register to determine the enumeration speed and perform the steps listed in initialization on enumeration completion (p. 281 ) at this point, the device is ready to accept sof packets and perform control transfers on control endpoint 0. 15.4.1.2.1 device connection the device connect process varies depending on the if the vbus is on or off when the device is connected to the usb cable. when vbus is on when the device is connected if vbus is on when the device is connected to the usb cable, there is no srp from the device. the device connection flow is as follows: 1. the device triggers the usb_gintsts.sessreqint [bit 30] interrupt bit. 2. when the device application detects the usb_gintsts.sessreqint interrupt, it programs the required bits in the usb_dcfg register. 3. when the host drives reset, the device triggers usb_gintsts.usbrst [bit 12] on detecting the reset. the host then follows the usb 2.0 enumeration sequence. when vbus is off when the device is connected if vbus is off when the device is connected to the usb cable, the device initiates srp in otg revision 1.3 mode. the device connection flow is as follows: 1. the application initiates srp by writing the session request bit in the otg control and status register. the core perform data-line pulsing followed by vbus pulsing. 2. the host starts a new session by turning on vbus, indicating srp success. the core interrupts the application by setting the session request success status change bit in the otg interrupt status register. 3. the application reads the session request success bit in the otg control and status register and programs the required bits in usb_dcfg register. 4. when host drives reset, the device triggers usb_gintsts.usbrst on detecting the reset. the host then follows the usb 2.0 enumeration sequence. 15.4.1.2.2 device disconnection the device session ends when the usb cable is disconnected or if the vbus is switched off by the host. the device disconnect flow is as follows: 1. when the usb cable is unplugged or when the vbus is switched off by the host, the device core trigger usb_gintsts.otgint [bit 2] interrupt bit. 2. when the device application detects usb_gintsts.otgint interrupt, it checks that the usb_gotgint.sesenddet (session end detected) bit is set to 1. 15.4.1.2.3 device soft disconnection the application can perform a soft disconnect by setting the soft disconnect bit (sftdiscon) in device control register (usb_dctl).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 249 www.energymicro.com send/receive usb transfers -> soft disconnect->soft reset->usb device enumeration sequence of operations: 1. the application configures the device to send or receive transfers. 2. the application sets the soft disconnect bit (sftdiscon) in the device control register (usb_dctl). 3. the application sets the soft reset bit (csftrst) in the reset register (usb_grstctl). 4. poll the usb_grstctl register until the core clears the soft reset bit, which ensures the soft reset is completed properly. 5. initialize the core according to the instructions in device initialization (p. 247 ) . suspend-> soft disconnect->soft reset->usb device enumeration sequence of operations: 1. the core detects a usb suspend and generates a suspend detected interrupt. 2. the application sets the stop phy clock bit in the power and clock gating control register, the core puts the phy in suspend mode, and the phy clock stops. 3. the application clears the stop phy clock bit in the power and clock gating control register, and waits for the phy clock to come back. the core takes the phy back to normal mode, and the phy clock comes back. 4. the application sets the soft disconnect bit (sftdiscon) in device control register (usb_dctl). 5. the application sets the soft reset bit (csftrst) in the reset register (usb_grstctl). 6. poll the usb_grstctl register until the core clears the soft reset bit, which ensures the soft reset is completed properly. 7. initialize the core according to the instructions in device initialization (p. 247 ) . 15.4.2 modes of operation ? overview: dma/slave modes (p. 249 ) ? dma mode (p. 249 ) ? slave mode (p. 250 ) 15.4.2.1 overview: dma/slave modes the application can operate the core in either of two modes: ? in dma mode (p. 249 ) - the core fetches the data to be transmitted or updates the received data on the ahb. ? in slave mode (p. 250 ) ? the application initiates the data transfers for data fetch and store. 15.4.2.2 dma mode in dma mode, the otg host uses the ahb master interface for transmit packet data fetch (ahb to usb) and receive data update (usb to ahb). the ahb master uses the programmed dma address (usb_hcx_dmaaddr register in host mode and usb_diepx_dmaaddr/usb_doepx_dmaaddr register in device mode) to access the data buffers. 15.4.2.2.1 transfer-level operation in dma mode, the application is interrupted only after the programmed transfer size is transmitted or received (provided the core detects no nak/timeout/error response in host mode, or timeout/crc error in device mode). the application must handle all transaction errors. in device mode, all the usb errors are handled by the core itself.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 250 www.energymicro.com 15.4.2.2.2 transaction-level operation this mode is similar to transfer-level operation with the programmed transfer size equal to one packet size (either maximum packet size, or a short packet size). 15.4.2.3 slave mode in slave mode, the application can operate the core either in transaction-level (packet-level) operation or in pipelined transaction-level operation. 15.4.2.3.1 transaction-level operation the application handles one data packet at a time per channel/endpoint in transaction-level operations. based on the handshake response received on the usb, the application determines whether to retry the transaction or proceed with the next, until the end of the transfer. the application is interrupted on completion of every packet. the application performs transaction-level operations for a channel/endpoint for a transmission (host: out/device: in) or reception (host: in/device: out) as shown in figure 15.8 (p. 251 ) and figure 15.9 (p. 251 ) . host mode for an out transaction, the application enables the channel and writes the data packet into the corresponding (periodic or non-periodic) transmit fifo. the core automatically writes the channel number into the corresponding (periodic or non-periodic) request queue, along with the last dword write of the packet. for an in transaction, the application enables the channel and the core automatically writes the channel number into the corresponding request queue. the application must wait for the packet received interrupt, then empty the packet from the receive fifo. device mode for an in transaction, the application enables the endpoint, writes the data packet into the corresponding transmit fifo, and waits for the packet completion interrupt from the core. for an out transaction, the application enables the endpoint, waits for the packet received interrupt from the core, then empties the packet from the receive fifo. note the application has to finish writing one complete packet before switching to a different channel/endpoint fifo. violating this rule results in an error.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 251 www.energymicro.com figure 15.8. transmit transaction-level operation in slave mode set up the channel / endpoint write 1 packet to the transmit fifo get channel / endpoint interrupt status done start rewrite packet to the transmit fifo yes yes no yes no transfer complete ? retry required ? get interrupt ? no figure 15.9. receive transaction-level operation in slave mode done st art yes ret ry required ? no no transfer com plet e ? yes read receive st at us queue no rxflvl or ch / ep int errupt ? yes set up t he channel / endpoint read t he packet from t he receive fifo
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 252 www.energymicro.com 15.4.2.3.2 pipelined transaction-level operation the application can pipeline more than one transaction (in or out) with pipelined transaction-level operation, which is analogous to transfer mode in dma mode. in pipelined transaction-level operation, the application can program the core to perform multiple transactions. the advantage of this mode compared to transaction-level operation is that the application is not interrupted on a packet basis. 15.4.2.3.2.1 host mode for an out transaction, the application sets up a transfer and enables the channel. the application can write multiple packets back-to-back for the same channel into the transmit fifo, based on the space availability. it can also pipeline out transactions for multiple channels by writing into the hcharn register, followed by a packet write to that channel. the core writes the channel number, along with the last dword write for the packet, into the request queue and schedules transactions on the usb in the same order. for an in transaction, the application sets up a transfer and enables the channel, and the core writes the channel number into the request queue. the application can schedule in transactions on multiple channels, provided space is available in the request queue. the core initiates an in token on the usb only when there is enough space to receive at least of one maximum-packet-size packet of the channel in the top of the request queue. 15.4.2.3.2.2 device mode for an in transaction, the application sets up a transfer and enables the endpoint. the application can write multiple packets back-to-back for the same endpoint into the transmit fifo, based on available space. it can also pipeline in transactions for multiple channels by writing into the usb_diepx_ctl register followed by a packet write to that endpoint. the core writes the endpoint number, along with the last dword write for the packet into the request queue. the core transmits the data in the transmit fifo when an in token is received on the usb. for an out transaction, the application sets up a transfer and enables the endpoint. the core receives the out data into the receive fifo, when it has available space. as the packets are received into the fifo, the application must empty data from it. from this point on in this chapter, the terms ?pipelined transaction mode? and ?transfer mode? are used interchangeably. 15.4.3 host programming model before you program the host, read overview: programming the core (p. 246 ) and modes of operation (p. 249 ) . this section discusses the following topics: ? channel initialization (p. 252 ) ? halting a channel (p. 253 ) ? zero-length packets (p. 254 ) ? handling babble conditions (p. 254 ) ? handling disconnects (p. 254 ) ? host programming operations (p. 254 ) ? writing the transmit fifo in slave mode (p. 255 ) ? reading the receive fifo in slave mode (p. 256 ) 15.4.3.1 channel initialization the application must initialize one or more channels before it can communicate with connected devices. to initialize and enable a channel, the application must perform the following steps.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 253 www.energymicro.com 1. program the usb_gintmsk register to unmask the following: 2. channel interrupt ? non-periodic transmit fifo empty for out transactions (applicable for slave mode that operates in pipelined transaction-level with the packet count field programmed with more than one). ? non-periodic transmit fifo half-empty for out transactions (applicable for slave mode that operates in pipelined transaction-level with the packet count field programmed with more than one). 3. program the usb_usb_haintmsk register to unmask the selected channels? interrupts. 4. program the hcintmsk register to unmask the transaction-related interrupts of interest given in the host channel interrupt register. 5. program the selected channel?s usb_hcx_tsiz register. program the register with the total transfer size, in bytes, and the expected number of packets, including short packets. the application must program the pid field with the initial data pid (to be used on the first out transaction or to be expected from the first in transaction). 6. program the selected channels? usb_hcx_dmaaddr register(s) with the buffer start address (dma mode only). 7. program the usb_hcx_char register of the selected channel with the device?s endpoint characteristics, such as type, speed, direction, and so forth. (the channel can be enabled by setting the channel enable bit to 1 only when the application is ready to transmit or receive any packet). repeat the above steps for other channels. note de-allocate channel means after the transfer has completed, the channel is disabled. when the application is ready to start the next transfer, the application re-initializes the channel by following these steps. 15.4.3.2 halting a channel the application can disable any channel by programming the usb_hcx_char register with the usb_hcx_char.chdis and usb_hcx_char.chena bits set to 1. this enables the host to flush the posted requests (if any) and generates a channel halted interrupt. the application must wait for the usb_hcx_int.chhltd interrupt before reallocating the channel for other transactions. the host does not interrupt the transaction that has been already started on usb. in slave mode operation, before disabling a channel, the application must ensure that there is at least one free space available in the non-periodic request queue (when disabling a non-periodic channel) or the periodic request queue (when disabling a periodic channel). the application can simply flush the posted requests when the request queue is full (before disabling the channel), by programming the usb_hcx_char register with the usb_hcx_char.chdis bit set to 1, and the usb_hcx_char.chena bit reset to 0. the core generates a rxflvl interrupt when there is an entry in the queue. the application must read/ pop the usb_grxstsp register to generate the channel halted interrupt. to disable a channel in dma mode operation, the application need not check for space in the request queue. the host checks for space in which to write the disable request on the disabled channel?s turn during arbitration. meanwhile, all posted requests are dropped from the request queue when the usb_hcx_char.chdis bit is set to 1. the application is expected to disable a channel under any of the following conditions: 1. when a usb_hcx_int.xfercompl interrupt is received during a non-periodic in transfer or high- bandwidth interrupt in transfer (slave mode only) 2. when a usb_hcx_int.stall, usb_hcx_int.xacterr, usb_hcx_int.bblerr, or usb_hcx_int.datatglerr interrupt is received for an in or out channel (slave mode only).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 254 www.energymicro.com for high-bandwidth interrupt ins in slave mode, once the application has received a datatglerr interrupt it must disable the channel and wait for a channel halted interrupt. the application must be able to receive other interrupts (datatglerr, nak, data, xacterr, bblerr) for the same channel before receiving the halt. 3. when a usb_gintsts.disconnint (disconnect device) interrupt is received. the application must check for the usb_hprt.prtconnsts, because when the device directly connected to the host is disconnected, usb_hprt.prtconnsts is reset. the software must issue a soft reset to ensure that all channels are cleared. when the device is reconnected, the host must issue a usb reset. 4. when the application aborts a transfer before normal completion (slave and dma modes). note in dma mode, keep the following guideline in mind: ? channel disable must not be programmed for periodic channels. at the end of the next frame (in the worst case), the core generates a channel halted and disables the channel automatically. 15.4.3.3 sending a zero-length packet in slave/dma modes to send a zero-length data packet, the application must initialize an out channel as follows. 1. program the usb_hcx_tsiz register of the selected channel with a correct pid, xfersize = 0, and pktcnt = 1. 2. program the usb_hcx_char register of the selected channel with chena = 1 and the device?s endpoint characteristics, such as type, speed, and direction. the application must treat a zero-length data packet as a separate transfer, and cannot combine it with a non-zero-length transfer. 15.4.3.4 handling babble conditions the core handles two cases of babble: packet babble and port babble. packet babble occurs if the device sends more data than the maximum packet size for the channel. port babble occurs if the core continues to receive data from the device at eof2 (the end of frame 2, which is very close to sof). when the core detects a packet babble, it stops writing data into the rx buffer and waits for the end of packet (eop). when it detects an eop, it flushes already-written data in the rx buffer and generates a babble interrupt to the application. when detects a port babble, it flushes the rxfifo and disables the port. the core then generates a port disabled interrupt (usb_gintsts.prtint, usb_hprt.prtenchng). on receiving this interrupt, the application must determine that this is not due to an overcurrent condition (another cause of the port disabled interrupt) by checking usb_hprt.prtovrcurract, then perform a soft reset. the core does not send any more tokens after it has detected a port babble condition. 15.4.3.5 handling disconnects if the device is disconnected suddenly, a usb_gintsts.disconnint interrupt is generated. when the application receives this interrupt, it must issue a soft reset by programming the usb_grstctl.csftrst bit. 15.4.3.6 host programming operations table 15.1 (p. 255 ) provides links to the programming sequence for the different types of usb transactions.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 255 www.energymicro.com table 15.1. host programming operations mode in out/setup control slave bulk and control in transactions in slave mode (p. 259 ) bulk and control out/setup transactions in slave mode (p. 257 ) dma bulk and control in transactions in dma mode (p. 265 ) bulk and control out/setup transactions in dma mode (p. 261 ) bulk slave bulk and control in transactions in slave mode (p. 259 ) bulk and control out/setup transactions in slave mode (p. 257 ) dma bulk and control in transactions in dma mode (p. 265 ) bulk and control out/setup transactions in dma mode (p. 261 ) interrupt slave interrupt in transactions in slave mode (p. 269 ) interrupt out transactions in slave mode (p. 267 ) dma interrupt in transactions in dma mode (p. 273 ) interrupt out transactions in dma mode (p. 271 ) isochronous slave isochronous in transactions in slave mode (p. 277 ) isochronous out transactions in slave mode (p. 275 ) dma isochronous in transactions in dma mode (p. 279 ) isochronous out transactions in dma mode (p. 278 ) 15.4.3.6.1 writing the transmit fifo in slave mode figure 15.10 (p. 256 ) shows the flow diagram for writing to the transmit fifo in slave mode. the host automatically writes an entry (out request) to the periodic/non-periodic request queue, along with the last dword write of a packet. the application must ensure that at least one free space is available in the periodic/non-periodic request queue before starting to write to the transmit fifo. the application must always write to the transmit fifo in dwords. if the packet size is non-dword aligned, the application must use padding. the host determines the actual packet size based on the programmed maximum packet size and transfer size.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 256 www.energymicro.com figure 15.10. transmit fifo write task in slave mode 1 mps or lps fifo space available? wait for usb_gahbcfg . nptxfemplvl or usb_gahbcfg . ptxfemplvl int errupt writ e 1 packet dat a t o transm it fifo yes no no yes mps : max packet size lps : last packet size st art done read usb_gnptxsts / usb _hptxfsiz regist ers for available fifo and queue spaces more packet s t o send ? 15.4.3.6.2 reading the receive fifo in slave mode figure 15.11 (p. 256 ) shows the flow diagram for reading the receive fifo in slave mode. the application must ignore all packet statuses other than in data packet (0b0010). figure 15.11. receive fifo read task in slave mode read usb_grxstsp pktsts = 0b0010 ? yes yes unm ask rxflvl int errupt bcnt > 0 ? no mask rxflvl int errupt yes unm ask rxflvl int errupt no no st art rxflvl int errupt ? read t he received packet from t he receive fifo 15.4.3.6.3 control transactions in slave mode setup, data, and status stages of a control transfer must be performed as three separate transfers. setup- data- or status-stage out transactions are performed similarly to the bulk out transactions explained in bulk and control out/setup transactions in slave mode (p. 257 ) . data- or status- stage in transactions are performed similarly to the bulk in transactions explained in bulk and control in transactions in slave mode (p. 259 ) for all three stages, the application is expected to set the usb_hc1_char.eptype field to control. during the setup stage, the application is expected to set the usb_hc1_tsiz.pid field to setup.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 257 www.energymicro.com 15.4.3.6.4 bulk and control out/setup transactions in slave mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . see figure 15.10 (p. 256 ) and figure 15.11 (p. 256 ) for read or write data to and from the fifo in slave mode. a typical bulk or control out/setup pipelined transaction-level operation in slave mode is shown in figure 15.12 (p. 258 ) . see channel 1 (ch_1). two bulk out packets are transmitted. a control setup transaction operates the same way but has only one packet. the assumptions are: ? the application is attempting to send two maximum-packet-size packets (transfer size = 1,024 bytes). ? the non-periodic transmit fifo can hold two packets (128 bytes for fs). ? the non-periodic request queue depth = 4. 15.4.3.6.4.1 normal bulk and control out/setup operations the sequence of operations in figure 15.12 (p. 258 ) (channel 1) is as follows: 1. initialize channel 1 as explained in channel initialization (p. 252 ) . 2. write the first packet for channel 1. 3. along with the last dword write, the core writes an entry to the non-periodic request queue. 4. as soon as the non-periodic queue becomes non-empty, the core attempts to send an out token in the current frame. 5. write the second (last) packet for channel 1. 6. the core generates the xfercompl interrupt as soon as the last transaction is completed successfully. 7. in response to the xfercompl interrupt, de-allocate the channel for other transfers.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 258 www.energymicro.com figure 15.12. normal bulk/control out/setup and bulk/control in transactions in slave mode a c k h ost ap p lica t ion d e vice ah b usb o u t d a t a 0 m p s 1 mps 1 mps writ e _ t x _ fifo ( ch _ 1 ) init _ reg ( ch _ 1 ) set _ ch _ en ( ch _ 2 ) init _ reg ( ch _ 2 ) writ e _ t x _ fifo ( ch _ 1 ) set _ ch _ en ( ch _ 2 ) ch _ 2 ch _ 2 ch _ 1 ch _ 1 de - allocat e ( ch _ 1 ) i n ch _ 2 ch _ 2 ch _ 2 ch _ 1 a c k o u t set _ ch _ en ( ch _ 2 ) 4 1 6 a c k d a t a 0 i n a c k read _ rx _ st s read _ rx _ fifo 1 mps set _ ch _ en ( ch _ 2 ) 1 mps read _ rx _ st sre ad _ rx _ fifo read _ rx _ st s disable ( ch _ 2 ) 1 2 3 4 5 6 7 de - allocat e ( ch _ 2 ) ch _ 2 2 3 5 7 8 9 1 2 1 3 read _ rx _ st s 1 0 1 1 d a t a 1 m p s d a t a 1 rxflvl int errupt xfercompl int errupt rxflvl int errupt rxflvl int errupt xfercompl int errupt rxflvl int errupt chhltd int errupt n on -pe r iod ic re q u e st qu e u e assum e t hat t his queue can hold 4 ent ries. 15.4.3.6.4.2 handling interrupts the channel-specific interrupt service routine for bulk and control out/setup transactions in slave mode is shown in the following code samples. interrupt service routine for bulk/control out/setup transactions in slave mode bulk/control out/setup unmask (nak/xacterr/stall/xfercompl) if (xfercompl) { reset error count mask ack de-allocate channel } else if (stall)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 259 www.energymicro.com { transfer done = 1 unmask chhltd disable channel } else if (nak or xacterr) { rewind buffer pointers unmask chhltd disable channel if (xacterr) { increment error count unmask ack } else { reset error count } } else if (chhltd) { mask chhltd if (transfer done or (error_count == 3)) { de-allocate channel } else { re-initialize channel } } else if (ack) { reset error count mask ack } the application is expected to write the data packets into the transmit fifo when space is available in the transmit fifo and the request queue. the application can make use of usb_gintsts.nptxfemp interrupt to find the transmit fifo space. the application is expected to write the requests as and when the request queue space is available and until the xfercompl interrupt is received. 15.4.3.6.5 bulk and control in transactions in slave mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . see figure 15.10 (p. 256 ) and figure 15.11 (p. 256 ) for read or write data to and from the fifo in slave mode. a typical bulk or control in pipelined transaction-level operation in slave mode is shown in figure 15.12 (p. 258 ) . see channel 2 (ch_2). the assumptions are: 1. the application is attempting to receive two maximum-sized packets (transfer size = 1,024 bytes). 2. the receive fifo can contain at least one maximum-packet-size packet and two status dwords per packet (72 bytes for fs). 3. the non-periodic request queue depth = 4. 15.4.3.6.5.1 normal bulk and control in operations the sequence of operations in figure 15.12 (p. 258 ) is as follows:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 260 www.energymicro.com 1. initialize channel 2 as explained in channel initialization (p. 252 ) . 2. set the usb_hc2_char.chena bit to write an in request to the non-periodic request queue. 3. the core attempts to send an in token after completing the current out transaction. 4. the core generates an rxflvl interrupt as soon as the received packet is written to the receive fifo. 5. in response to the rxflvl interrupt, mask the rxflvl interrupt and read the received packet status to determine the number of bytes received, then read the receive fifo accordingly. following this, unmask the rxflvl interrupt. 6. the core generates the rxflvl interrupt for the transfer completion status entry in the receive fifo. 7. the application must read and ignore the receive packet status when the receive packet status is not an in data packet (usb_grxstsr.pktsts != 0b0010). 8. the core generates the xfercompl interrupt as soon as the receive packet status is read. 9. in response to the xfercompl interrupt, disable the channel (see halting a channel (p. 253 ) ) and stop writing the usb_hc2_char register for further requests. the core writes a channel disable request to the non-periodic request queue as soon as the usb_hc2_char register is written. 10. the core generates the rxflvl interrupt as soon as the halt status is written to the receive fifo. 11. read and ignore the receive packet status. 12. the core generates a chhltd interrupt as soon as the halt status is popped from the receive fifo. 13. in response to the chhltd interrupt, de-allocate the channel for other transfers. note for bulk/control in transfers, the application must write the requests when the request queue space is available, and until the xfercompl interrupt is received. 15.4.3.6.5.2 handling interrupts the channel-specific interrupt service routine for bulk and control in transactions in slave mode is shown in the following code samples. interrupt service routine for bulk/control in transactions in slave mode unmask (xacterr/xfercompl/bblerr/stall/datatglerr) if (xfercompl) { reset error count unmask chhltd disable channel reset error count mask ack } else if (xacterr or bblerr or stall) { unmask chhltd disable channel if (xacterr) { increment error count unmask ack } } else if (chhltd) { mask chhltd if (transfer done or (error_count == 3)) { de-allocate channel } else { re-initialize channel }
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 261 www.energymicro.com } else if (ack) { reset error count mask ack } else if (datatglerr) { reset error count } 15.4.3.6.6 control transactions in dma mode setup, data, and status stages of a control transfer must be performed as three separate transfers. setup- and data- or status-stage out transactions are performed similarly to the bulk out transactions explained in bulk and control out/setup transactions in dma mode (p. 261 ) . data- or status- stage in transactions are performed similarly to the bulk in transactions explained in bulk and control in transactions in dma mode (p. 265 ) . for all three stages, the application is expected to set the usb_hc1_char.eptype field to control. during the setup stage, the application is expected to set the usb_hc1_tsiz.pid field to setup. 15.4.3.6.7 bulk and control out/setup transactions in dma mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . this section discusses the following topics: ? overview (p. 261 ) ? normal bulk and control out/setup operations (p. 261 ) ? nak handling with dma (p. 261 ) ? handling interrupts (p. 263 ) 15.4.3.6.7.1 overview ? the application is attempting to send two maximum-packet-size packets (transfer size = 1,024 bytes). ? the non-periodic transmit fifo can hold two packets (128 bytes for fs). ? the non-periodic request queue depth = 4. 15.4.3.6.7.2 normal bulk and control out/setup operations the sequence of operations in figure 15.12 (p. 258 ) is as follows: 1. initialize and enable channel 1 as explained in channel initialization (p. 252 ) . 2. the host starts fetching the first packet as soon as the channel is enabled. for dma mode, the host uses the programmed dma address to fetch the packet. 3. after fetching the last dword of the second (last) packet, the host masks channel 1 internally for further arbitration. 4. the host generates a chhltd interrupt as soon as the last packet is sent. 5. in response to the chhltd interrupt, de-allocate the channel for other transfers. the channel-specific interrupt service routine for bulk and control out/setup transactions in dma mode is shown in handling interrupts (p. 263 ) . 15.4.3.6.7.3 nak handling with dma 1. the host sends a bulk out transaction.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 262 www.energymicro.com 2. the device responds with nak. 3. if the application has unmasked nak, the core generates the corresponding interrupt(s) to the application. the application is not required to service these interrupts, since the core takes care of rewinding of buffer pointers and re-initializing the channel without application intervention. 4. when the device returns an ack, the core continues with the transfer. optionally, the application can utilize these interrupts. if utilized by the application: ? the nak interrupt is masked by the application. ? the core does not generate a separate interrupt when nak is received by the host functionality. application programming flow 1. the application programs a channel to do a bulk transfer for a particular data size in each transaction. ? packet data size can be up to 512 kbytes ? zero-length data must be programmed as a separate transaction. 2. program the transfer size register with: ? transfer size ? packet count 3. program the dma address. 4. program the usb_hcx_char to enable the channel. 5. the interrupt handling by the application is as depicted in the flow diagram. note the nak interrupts are still generated internally. the application can mask off these interrupts from reaching it. the application can use these interrupts optionally.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 263 www.energymicro.com figure 15.13. normal bulk/control out/setup and bulk/control in transactions in dma mode a c k h ost ap p lica t ion d e vice ah b usb o u t d a t a 0 m p s 1 mps 1 mps init _ reg ( ch _ 1 ) init _ reg ( ch _ 2 ) ch _ 2 ch _ 2 ch _ 1 ch _ 1 de - allocat e ( ch _ 1 ) i n ch _ 2 ch _ 2 ch _ 2 ch _ 1 a c k o u t d a t a 1 m p s 3 1 a c k d a t a 0 i n a c k d a t a 1 1 mps 1 mps 1 2 2 5 4 5 de - allocat e ( ch _ 2 ) ch _ 2 8 6 3 4 7 chhltd int errupt chhltd int errupt n on -pe r iod ic re q u e st qu e u e assum e t hat t his queue can hold 4 ent ries. 15.4.3.6.7.4 handling interrupts the channel-specific interrupt service routine for bulk and control out/setup transactions in dma mode is shown in the following code samples.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 264 www.energymicro.com figure 15.14. interrupt service routine for bulk/control out transaction in dma mode int errupt ? no yes st art yes , no / no yes no deallocat e channel yes yes yes , no usb_hcx_int. ack = 1? usb_hcx_int.xacterr = 1 usb_hcx_int.xfercompl = 1 usb_hcx_int.stall = 1 or usb_hcx_int.ack = 1 usb_hcx_int.nak = 1 reset err_cnt err_cnt = err _cnt + 1 err_cnt = = 3 ? 1. reprogram buffer point ers 2 . re-init ialize channel 1. err_cnt = 1 2 . re-init ialize channel 3 . reprogram buffer point ers 1. reset err_cnt 2 . deallocat e channel service based on t he ot her int errupt st at us bit s nam ely : ahberr, frmovrerr , bblerr and datatglerr unm asked t he required usb _haintmsk and usb _hcx_intmsk st at us bit s read usb_haint t o det erm ine t he channel which caused t he int errupt and read t he corresponding usb _hcx_int usb_hcx_int. chhltd = 1 ? in figure 15.14 (p. 264 ) that the interrupt service routine is not required to handle nak responses. this is the difference of proposed flow with respect to current flow. similar flow is applicable for control flow also. the nak status bits in usb_hcx_int registers are updated. the application can unmask these interrupts when it requires the core to generate an interrupt for nak. the nak status is updated because during xact_err scenarios, this status provides a means for the application to determine whether the xact_err occurred three times consecutively or there were nak responses in between two xact_err. this provides a mechanism for the application to reset the error counter accordingly. the application
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 265 www.energymicro.com must read the nak/ack along with the xact_err. if nak/ack is not set, the xact_err count must be incremented otherwise application must initialize the xact_err count to 1. bulk/control out/setup unmask (chhltd) if (chhltd) { if (xfercompl or stall) { reset error count (error_count=1) mask ack de-allocate channel } else if (xacterr) { if (nak/ack) { error_count = 1 re-initialize channel rewind buffer pointers } else { error_count = error_count + 1 if (error_count == 3) { de allocate channel } else { re-initialize channel rewind buffer pointers } } } } else if (ack) { reset error count (error_count=1) mask ack } as soon as the channel is enabled, the core attempts to fetch and write data packets, in multiples of the maximum packet size, to the transmit fifo when space is available in the transmit fifo and the request queue. the core stops fetching as soon as the last packet is fetched. 15.4.3.6.8 bulk and control in transactions in dma mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . a typical bulk or control in operation in dma mode is shown in figure 15.13 (p. 263 ) . see channel 2 (ch_2). the assumptions are: 1. the application is attempting to receive two maximum-packet-size packets (transfer size = 1,024 bytes). 2. the receive fifo can hold at least one maximum-packet-size packet and two status dwords per packet (72 bytes for fs).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 266 www.energymicro.com 3. the non-periodic request queue depth = 4. 15.4.3.6.8.1 normal bulk and control in operations the sequence of operations in figure 15.13 (p. 263 ) is as follows: 1. initialize and enable channel 2 as explained in channel initialization (p. 252 ) . 2. the host writes an in request to the request queue as soon as channel 2 receives the grant from the arbiter. (arbitration is performed in a round-robin fashion, with fairness.). 3. the host starts writing the received data to the system memory as soon as the last byte is received with no errors. 4. when the last packet is received, the host sets an internal flag to remove any extra in requests from the request queue. 5. the host flushes the extra requests. 6. the final request to disable channel 2 is written to the request queue. at this point, channel 2 is internally masked for further arbitration. 7. the host generates the chhltd interrupt as soon as the disable request comes to the top of the queue. 8. in response to the chhltd interrupt, de-allocate the channel for other transfers. 15.4.3.6.8.2 handling interrupts the channel-specific interrupt service routine for bulk and control in transactions in dma mode is shown in the following flow: interrupt service routines for bulk/control bulk/control in transactions in dma mode bulk/control in unmask (chhltd) if (chhltd) { if (xfercompl or stall or bblerr) { reset error count mask ack de-allocate channel } else if (xacterr) { if (error_count == 2) { de-allocate channel } else { unmask ack unmask nak unmask datatglerr increment error count re-initialize channel } } } else if (ack or nak or datatglerr) { reset error count mask ack mask nak mask datatglerr }
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 267 www.energymicro.com 15.4.3.6.9 interrupt out transactions in slave mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . see figure 15.10 (p. 256 ) and figure 15.11 (p. 256 ) for read or write data to and from the fifo in slave mode. a typical interrupt out operation in slave mode is shown in figure 15.15 (p. 268 ) . see channel 1 (ch_1). the assumptions are: ? the application is attempting to send one packet in every frame (up to 1 maximum packet size), starting with the odd frame (transfer size = 1,024 bytes). ? the periodic transmit fifo can hold one packet. ? periodic request queue depth = 4. 15.4.3.6.9.1 normal interrupt out operation the sequence of operations in figure 15.15 (p. 268 ) is as follows: 1. initialize and enable channel 1 as explained in channel initialization (p. 252 ) . the application must set the usb_hc1_char.oddfrm bit. 2. write the first packet for channel 1. for a high-bandwidth interrupt transfer, the application must write the subsequent packets up to mc (maximum number of packets to be transmitted in the next frame times before switching to another channel). 3. along with the last dword write of each packet, the host writes an entry to the periodic request queue. 4. the host attempts to send an out token in the next (odd) frame. 5. the host generates an xfercompl interrupt as soon as the last packet is transmitted successfully. 6. in response to the xfercompl interrupt, reinitialize the channel for the next transfer. 15.4.3.6.9.2 handling interrupts the channel-specific interrupt service routine for interrupt out transactions in slave mode is shown in the following flow:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 268 www.energymicro.com figure 15.15. normal interrupt out/in transactions in slave mode h ost ap p lica t ion d e vice ah b usb o u t d a t a 0 m p s 1 mps 1 mps writ e _ t x _ fifo ( ch _ 1 ) init _ reg ( ch _ 1 ) set _ ch _ en ( ch _ 2 ) init _ reg ( ch _ 2 ) writ e _ t x _ fifo ( ch _ 1 ) i n o u t d a t a 1 m p s periodic request queue assum e t hat t his queue can hold 4 ent ries . 1 5 d a t a 0 i n 1 mps read _ rx _ st s read _ rx _ fifo read _ rx _ st s 1 2 3 4 6 2 3 6 7 8 9 odd fram e even fram e init _ reg ( ch _ 1 ) set _ ch _ en ( ch _ 2 ) init _ reg ( ch _ 2 ) writ e _ t x _ fifo ( ch _ 1 ) init _ reg ( ch _ 1 ) 1 mps d a t a 1 5 4 a c k a c k a c k ch _ 1 ch _ 2 ch _ 2 ch _ 1 xfercompl int errupt xfercompl int errupt xfercompl int errupt rxflvl int errupt rxflvl int errupt interrupt service routine for interrupt out transactions in slave mode interrupt out unmask (nak/xacterr/stall/xfercompl/frmovrun) if (xfercompl) { reset error count mask ack de-allocate channel } else if (stall or frmovrun) { mask ack unmask chhltd disable channel if (stall) { transfer done = 1 }
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 269 www.energymicro.com } else if (nak or xacterr) { rewind buffer pointers reset error count mask ack unmask chhltd disable channel } else if (chhltd) { mask chhltd if (transfer done or (error_count == 3)) { de-allocate channel } else { re-initialize channel (in next b_interval - 1 frame) } } else if (ack) { reset error count mask ack } the application is expected to write the data packets into the transmit fifo when the space is available in the transmit fifo and the request queue up to the count specified in the mc field before switching to another channel. the application uses the usb_gintsts.nptxfemp interrupt to find the transmit fifo space. 15.4.3.6.10 interrupt in transactions in slave mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . see transmit fifo write task in slave mode and receive fifo read task in slave mode for read or write data to and from the fifo in slave mode. a typical interrupt-in operation in slave mode is shown in figure 15.15 (p. 268 ) . see channel 2 (ch_2). the assumptions are: 1. the application is attempting to receive one packet (up to 1 maximum packet size) in every frame, starting with odd. (transfer size = 1,024 bytes). 2. the receive fifo can hold at least one maximum-packet-size packet and two status dwords per packet (1,031 bytes for fs). 3. periodic request queue depth = 4. 15.4.3.6.10.1 normal interrupt in operation the sequence of operations in figure 15.15 (p. 268 ) (channel 2) is as follows: 1. initialize channel 2 as explained in channel initialization (p. 252 ) . the application must set the usb_hc2_char.oddfrm bit. 2. set the usb_hc2_char.chena bit to write an in request to the periodic request queue. for a high-bandwidth interrupt transfer, the application must write the usb_hc2_char register mc (maximum number of expected packets in the next frame) times before switching to another channel. 3. the host writes an in request to the periodic request queue for each usb_hc2_char register write with a chena bit set. 4. the host attempts to send an in token in the next (odd) frame.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 270 www.energymicro.com 5. as soon as the in packet is received and written to the receive fifo, the host generates an rxflvl interrupt. 6. in response to the rxflvl interrupt, read the received packet status to determine the number of bytes received, then read the receive fifo accordingly. the application must mask the rxflvl interrupt before reading the receive fifo, and unmask after reading the entire packet. 7. the core generates the rxflvl interrupt for the transfer completion status entry in the receive fifo. the application must read and ignore the receive packet status when the receive packet status is not an in data packet (usb_grxstsr.pktsts != 0b0010). 8. the core generates an xfercompl interrupt as soon as the receive packet status is read. 9. in response to the xfercompl interrupt, read the usb_hc2_tsiz.pktcnt field. if usb_hc2_tsiz.pktcnt != 0, disable the channel (as explained in halting a channel (p. 253 ) ) before re-initializing the channel for the next transfer, if any). if usb_hc2_tsiz.pktcnt == 0, reinitialize the channel for the next transfer. this time, the application must reset the usb_hc2_char.oddfrm bit. 15.4.3.6.10.2 handling interrupts the channel-specific interrupt service routine for an interrupt in transaction in slave mode is a follows. interrupt in unmask (nak/xacterr/xfercompl/bblerr/stall/frmovrun/datatglerr) if (xfercompl) { reset error count mask ack if (usb_hcx_tsiz.pktcnt == 0) { de-allocate channel } else { transfer done = 1 unmask chhltd disable channel } } else if (stall or frmovrun or nak or datatglerr or bblerr) { mask ack unmask chhltd disable channel if (stall or bblerr) { reset error count transfer done = 1 } else if (!frmovrun) { reset error count } } else if (xacterr) { increment error count unmask ack unmask chhltd disable channel } else if (chhltd) { mask chhltd
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 271 www.energymicro.com if (transfer done or (error_count == 3)) { de-allocate channel } else { re-initialize channel (in next b_interval - 1 frame) } } else if (ack) { reset error count mask ack } the application is expected to write the requests for the same channel when the request queue space is available up to the count specified in the mc field before switching to another channel (if any). 15.4.3.6.11 interrupt out transactions in dma mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . a typical interrupt out operation in dma mode is shown in figure 15.16 (p. 272 ) . see channel 1 (ch_1). the assumptions are: ? the application is attempting to transmit one packet in every frame (up to 1 maximum packet size of 1,024 bytes). ? the periodic transmit fifo can hold one packet (1 kb for fs). ? periodic request queue depth = 4. 15.4.3.6.11.1 normal interrupt out operation 1. initialize and enable channel 1 as explained in channel initialization (p. 252 ) . 2. the host starts fetching the first packet as soon the channel is enabled and writes the out request along with the last dword fetch. in high-bandwidth transfers, the host continues fetching the next packet (up to the value specified in the mc field) before switching to the next channel. 3. the host attempts to send the out token in the beginning of the next odd frame. 4. after successfully transmitting the packet, the host generates a chhltd interrupt. 5. in response to the chhltd interrupt, reinitialize the channel for the next transfer.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 272 www.energymicro.com figure 15.16. normal interrupt out/in transactions in dma mode d a t a 1 m p s h ost ap p lica t ion d e vice ah b usb o u t d a t a 0 m p s 1 mps 1 mps init _ reg ( ch _ 1 ) init _ reg ( ch _ 2 ) ch _ 2 ch _ 1 i n o u t pe r iod ic re q u e st qu e u e assum e t hat t his queue can hold 4 ent ries . 1 d a t a 0 i n 1 mps 1 2 3 5 ch _ 1 2 4 5 init _ reg ( ch _ 1 ) init _ reg ( ch _ 2 ) init _ reg ( ch _ 1 ) 1 mps d a t a 1 ch _ 2 4 3 a c k a c k a c k odd fram e even fram e chhltd int errupt chhltd int errupt chhltd int errupt 15.4.3.6.11.2 handling interrupts the following code sample shows the channel-specific isr for an interrupt out transaction in dma mode. interrupt out unmask (chhltd) if (chhltd) { if (xfercompl) { reset error count mask ack if (transfer done) { de-allocate channel } else {
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 273 www.energymicro.com re-initialize channel (in next b_interval - 1 frame) } } else if (stall) { transfer done = 1 reset error count mask ack de-allocate channel } else if (nak or frmovrun) { mask ack rewind buffer pointers re-initialize channel (in next b_interval - 1 frame) if (nak) { reset error count } } else if (xacterr) { if (error_count == 2) { de-allocate channel } else { increment error count rewind buffer pointers unmask ack re-initialize channel (in next b_interval - 1 frame) } } } else if (ack) { reset error count mask ack } as soon as the channel is enabled, the core attempts to fetch and write data packets, in maximum packet size multiples, to the transmit fifo when the space is available in the transmit fifo and the request queue. the core stops fetching as soon as the last packet is fetched (the number of packets is determined by the mc field of the usb_hcx_char register). 15.4.3.6.12 interrupt in transactions in dma mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . a typical interrupt in operation in dma mode is shown in figure 15.16 (p. 272 ) . see channel 2 (ch_2). the assumptions are: ? the application is attempting to receive one packet in every frame (up to 1 maximum packet size of 1,024 bytes). ? the receive fifo can hold at least one maximum-packet-size packet and two status dwords per packet (1,032 bytes for fs). ? periodic request queue depth = 4. 15.4.3.6.12.1 normal interrupt in operation the sequence of operations in figure 15.16 (p. 272 ) (channel 2) is as follows:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 274 www.energymicro.com 1. initialize and enable channel 2 as explained in channel initialization (p. 252 ) . 2. the host writes an in request to the request queue as soon as the channel 2 gets the grant from the arbiter (round-robin with fairness). in high-bandwidth transfers, the host writes consecutive writes up to mc times. 3. the host attempts to send an in token at the beginning of the next (odd) frame. 4. as soon the packet is received and written to the receive fifo, the host generates a chhltd interrupt. 5. in response to the chhltd interrupt, reinitialize the channel for the next transfer. 15.4.3.6.12.2 handling interrupts the channel-specific interrupt service routine for interrupt in transactions in dma mode is as follows. interrupt service routine for interrupt in transactions in dma mode unmask (chhltd) if (chhltd) { if (xfercompl) { reset error count mask ack if (transfer done) { de-allocate channel } else { re-initialize channel (in next b_interval - 1 frame) } } else if (stall or bblerr) { reset error count mask ack de-allocate channel } else if (nak or datatglerr or frmovrun) { mask ack re-initialize channel (in next b_interval - 1 frame) if (datatglerr or nak) { reset error count } } else if (xacterr) { if (error_count == 2) { de-allocate channel } else { increment error count unmask ack re-initialize channel (in next b_interval - 1 frame) } } } else if (ack) { reset error count mask ack
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 275 www.energymicro.com } as soon as the channel is enabled, the core attempts to write the requests into the request queue when the space is available up to the count specified in the mc field. 15.4.3.6.13 isochronous out transactions in slave mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . see t figure 15.10 (p. 256 ) and figure 15.11 (p. 256 ) for read or write data to and from the fifo in slave mode. a typical isochronous out operation in slave mode is shown in figure 15.17 (p. 276 ) . see channel 1 (ch_1). the assumptions are: ? the application is attempting to send one packet every frame (up to 1 maximum packet size), starting with an odd frame. (transfer size = 1,024 bytes). ? the periodic transmit fifo can hold one packet (1 kb). ? periodic request queue depth = 4. 15.4.3.6.13.1 normal isochronous out operation the sequence of operations in figure 15.17 (p. 276 ) (channel 1) is as follows: 1. initialize and enable channel 1 as explained in channel initialization (p. 252 ) . the application must set the usb_hc1_char.oddfrm bit. 2. write the first packet for channel 1. for a high-bandwidth isochronous transfer, the application must write the subsequent packets up to mc (maximum number of packets to be transmitted in the next frame) times before switching to another channel. 3. along with the last dword write of each packet, the host writes an entry to the periodic request queue. 4. the host attempts to send the out token in the next frame (odd). 5. the host generates the xfercompl interrupt as soon as the last packet is transmitted successfully. 6. in response to the xfercompl interrupt, reinitialize the channel for the next transfer. 15.4.3.6.13.2 handling interrupts the channel-specific interrupt service routine for isochronous out transactions in slave mode is shown in the following flow:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 276 www.energymicro.com figure 15.17. normal isochronous out/in transactions in slave mode h ost ap p lica t ion d e vice ah b usb o u t d a t a 0 m p s 1 mps 1 mps writ e _ t x _ fifo ( ch _ 1 ) init _ reg ( ch _ 1 ) set _ ch _ en ( ch _ 2 ) init _ reg ( ch _ 2 ) writ e _ t x _ fifo ( ch _ 1 ) ch _ 2 ch _ 1 i n o u t d a t a 0 m p s 1 5 d a t a 0 i n 1 mps read _ rx _ st s read _ rx _ fifo read _ rx _ st s 1 2 3 4 6 2 3 6 7 8 9 init _ reg ( ch _ 1 ) set _ ch _ en ( ch _ 2 ) init _ reg ( ch _ 2 ) writ e _ t x _ fifo ( ch _ 1 ) init _ reg ( ch _ 1 ) 1 mps d a t a 0 5 4 ch _ 2 ch _ 1 even fram e odd fram e xfercompl int errupt xfercompl int errupt xfercompl int errupt rxflvl int errupt rxflvl int errupt pe r iod ic re q u e st s qu e u e asum e t hat t his queue can hold 4 ent ries. interrupt service routine for isochronous out transactions in slave mode isochronous out unmask (frmovrun/xfercompl) if (xfercompl) { de-allocate channel } else if (frmovrun) { unmask chhltd disable channel } else if (chhltd) { mask chhltd de-allocate channel }
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 277 www.energymicro.com 15.4.3.6.14 isochronous in transactions in slave mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . see figure 15.10 (p. 256 ) and figure 15.11 (p. 256 ) for read or write data to and from the fifo in slave mode. a typical isochronous in operation in slave mode is shown in figure 15.17 (p. 276 ) . see channel 2 (ch_2). the assumptions are: ? the application is attempting to receive one packet (up to 1 maximum packet size) in every frame starting with the next odd frame. (transfer size = 1,024 bytes). ? the receive fifo can hold at least one maximum-packet-size packet and two status dwords per packet (1,031 bytes for fs). ? periodic request queue depth = 4. 15.4.3.6.14.1 normal isochronous in operation the sequence of operations in figure 15.17 (p. 276 ) (channel 2) is as follows: 1. initialize channel 2 as explained in channel initialization (p. 252 ) . the application must set the usb_hc2_char.oddfrm bit. 2. set the usb_hc2_char.chena bit to write an in request to the periodic request queue. for a high-bandwidth isochronous transfer, the application must write the usb_hc2_char register mc (maximum number of expected packets in the next frame) times before switching to another channel. 3. the host writes an in request to the periodic request queue for each usb_hc2_char register write with the chena bit set. 4. the host attempts to send an in token in the next odd frame. 5. as soon as the in packet is received and written to the receive fifo, the host generates an rxflvl interrupt. 6. in response to the rxflvl interrupt, read the received packet status to determine the number of bytes received, then read the receive fifo accordingly. the application must mask the rxflvl interrupt before reading the receive fifo, and unmask it after reading the entire packet. 7. the core generates an rxflvl interrupt for the transfer completion status entry in the receive fifo. this time, the application must read and ignore the receive packet status when the receive packet status is not an in data packet (usb_grxstsr.pktsts != 0b0010). 8. the core generates an xfercompl interrupt as soon as the receive packet status is read. 9. in response to the xfercompl interrupt, read the usb_hc2_tsiz.pktcnt field. if usb_hc2_tsiz.pktcnt != 0, disable the channel (as explained in halting a channel (p. 253 ) ) before re-initializing the channel for the next transfer, if any. if usb_hc2_tsiz.pktcnt == 0, reinitialize the channel for the next transfer. this time, the application must reset the usb_hc2_char.oddfrm bit. 15.4.3.6.14.2 handling interrupts the channel-specific interrupt service routine for an isochronous in transaction in slave mode is as follows. isochronous in unmask (xacterr/xfercompl/frmovrun/bblerr) if (xfercompl or frmovrun) { if (xfercompl and (usb_hcx_tsiz.pktcnt == 0))
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 278 www.energymicro.com { reset error count de-allocate channel } else { unmask chhltd disable channel } } else if (xacterr or bblerr) { increment error count unmask chhltd disable channel } else if (chhltd) { mask chhltd if (transfer done or (error_count == 3)) { de-allocate channel } else { re-initialize channel } } 15.4.3.6.15 isochronous out transactions in dma mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) . a typical isochronous out operation in dma mode is shown in figure 15.18 (p. 279 ) . see channel 1 (ch_1). the assumptions are: ? the application is attempting to transmit one packet every frame (up to 1 maximum packet size of 1,024 bytes). ? the periodic transmit fifo can hold one packet (1 kb). ? periodic request queue depth = 4. 15.4.3.6.15.1 normal isochronous out operation 1. initialize and enable channel 1 as explained in channel initialization (p. 252 ) . 2. the host starts fetching the first packet as soon as the channel is enabled, and writes the out request along with the last dword fetch. in high-bandwidth transfers, the host continues fetching the next packet (up to the value specified in the mc field) before switching to the next channel. 3. the host attempts to send an out token in the beginning of the next (odd) frame. 4. after successfully transmitting the packet, the host generates a chhltd interrupt. 5. in response to the chhltd interrupt, reinitialize the channel for the next transfer. 15.4.3.6.15.2 handling interrupts the channel-specific interrupt service routine for isochronous out transactions in dma mode is shown in the following flow:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 279 www.energymicro.com figure 15.18. normal isochronous out/in transactions in dma mode h ost ap p lica t ion d e vice ah b usb o u t d a t a 0 m p s 1 mps 1 mps init _ reg ( ch _ 1 ) init _ reg ( ch _ 2 ) ch _ 2 ch _ 1 i n o u t d a t a 0 m p s pe r iod ic re q u e st qu e u e assum e t hat t his queue can hold 4 ent ries . 1 d a t a 0 i n 1 mps 1 2 3 5 ch _ 1 2 4 5 init _ reg ( ch _ 1 ) init _ reg ( ch _ 2 ) init _ reg ( ch _ 1 ) 1 mps d a t a 0 ch _ 2 4 3 odd fram e even fram e chhltd int errupt chhltd int errupt chhltd int errupt interrupt service routine for isochronous out transactions in dma mode isochronous out unmask (chhltd) if (chhltd) { if (xfercompl or frmovrun) { de-allocate channel } } 15.4.3.6.16 isochronous in transactions in dma mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the connected device, it must initialize a channel as described in channel initialization (p. 252 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 280 www.energymicro.com a typical isochronous in operation in dma mode is shown in figure 15.18 (p. 279 ) . see channel 2 (ch_2). the assumptions are: ? the application is attempting to receive one packet in every frame (up to 1 maximum packet size of 1,024 bytes). ? the receive fifo can hold at least one maximum-packet-size packet and two status dwords per packet (1,031 bytes). ? periodic request queue depth = 4. 15.4.3.6.16.1 normal isochronous in operation the sequence of operations in figure 15.18 (p. 279 ) (channel 2) is as follows: 1. initialize and enable channel 2 as explained in channel initialization (p. 252 ) . 2. the host writes an in request to the request queue as soon as the channel 2 gets the grant from the arbiter (round-robin with fairness). in high-bandwidth transfers, the host performs consecutive writes up to mc times. 3. the host attempts to send an in token at the beginning of the next (odd) frame. 4. as soon the packet is received and written to the receive fifo, the host generates a chhltd interrupt. 5. in response to the chhltd interrupt, reinitialize the channel for the next transfer. 15.4.3.6.16.2 handling interrupts the channel-specific interrupt service routine for an isochronous in transaction in dma mode is as follows. isochronous in unmask (chhltd) if (chhltd) { if (xfercompl or frmovrun) { if (xfercompl and (usb_hcx_tsiz.pktcnt == 0)) { reset error count de-allocate channel } else { de-allocate channel } } else if (xacterr or bblerr) { if (error_count == 2) { de-allocate channel } else { increment error count re-enable channel (in next b_interval - 1 frame) } } }
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 281 www.energymicro.com 15.4.4 device programming model before you program the device, be sure to read overview: programming the core (p. 246 ) and modes of operation (p. 249 ) 15.4.4.1 endpoint initialization this section addresses the following topics: ? initialization on usb reset (p. 281 ) ? initialization on enumeration completion (p. 281 ) ? initialization on setaddress command (p. 282 ) ? initialization on setconfiguration/setinterface command (p. 282 ) ? endpoint activation (p. 282 ) ? endpoint deactivation (p. 282 ) ? device dma/slave mode initialization (p. 283 ) 15.4.4.1.1 initialization on usb reset 1. set the nak bit for all out endpoints ? usb_doepx_ctl.snak = 1 (for all out endpoints) 2. unmask the following interrupt bits: ? usb_usb_daintmsk.inep0 = 1 (control 0 in endpoint) ? usb_usb_daintmsk.outep0 = 1 (control 0 out endpoint) ? usb_doepmsk.setup = 1 ? usb_doepmsk.xfercompl = 1 ? usb_diepmsk.xfercompl = 1 ? usb_diepmsk.timeoutmsk = 1 3. to transmit or receive data, the device must initialize more registers as specified in device dma/ slave mode initialization (p. 283 ) . 4. set up the data fifo ram for each of the fifos ? program the usb_grxfsiz register, to be able to receive control out data and setup data. at a minimum, this must be equal to 1 max packet size of control endpoint 0 + 2 dwords (for the status of the control out data packet) + 10 dwords (for setup packets). ? program the device in endpoint transmit fifo size register (depending on the fifo number chosen), to be able to transmit control in data. at a minimum, this must be equal to 1 max packet size of control endpoint 0. 5. program the following fields in the endpoint-specific registers for control out endpoint 0 to receive a setup packet ? usb_doep0tsiz.supcnt = 3 (to receive up to 3 back-to-back setup packets) ? in dma mode, usb_doep0dmaaddr register with a memory address to store any setup packets received at this point, all initialization required to receive setup packets is done, except for enabling control out endpoint 0 in dma mode. 15.4.4.1.2 initialization on enumeration completion 1. on the enumeration done interrupt (usb_gintsts.enumdone, read the usb_dsts register to determine the enumeration speed. 2. program the usb_diep0ctl.mps field to set the maximum packet size. this step configures control endpoint 0. the maximum packet size for a control endpoint depends on the enumeration speed. 3. in dma mode, program the usb_doep0ctl register to enable control out endpoint 0, to receive a setup packet. ? usb_doep0ctl.epena = 1
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 282 www.energymicro.com at this point, the device is ready to receive sof packets and is configured to perform control transfers on control endpoint 0. 15.4.4.1.3 initialization on setaddress command this section describes what the application must do when it receives a setaddress command in a setup packet. 1. program the usb_dcfg register with the device address received in the setaddress command 2. program the core to send out a status in packet. 15.4.4.1.4 initialization on setconfiguration/setinterface command this section describes what the application must do when it receives a setconfiguration or setinterface command in a setup packet. 1. when a setconfiguration command is received, the application must program the endpoint registers to configure them with the characteristics of the valid endpoints in the new configuration. 2. when a setinterface command is received, the application must program the endpoint registers of the endpoints affected by this command. 3. some endpoints that were active in the prior configuration or alternate setting are not valid in the new configuration or alternate setting. these invalid endpoints must be deactivated. 4. for details on a particular endpoint?s activation or deactivation, see endpoint activation (p. 282 ) and endpoint deactivation (p. 282 ) . 5. unmask the interrupt for each active endpoint and mask the interrupts for all inactive endpoints in the usb_usb_daintmsk register. 6. set up the data fifo ram for each fifo. see data fifo ram allocation (p. 327 ) for more detail. 7. after all required endpoints are configured, the application must program the core to send a status in packet. at this point, the device core is configured to receive and transmit any type of data packet. 15.4.4.1.5 endpoint activation this section describes the steps required to activate a device endpoint or to configure an existing device endpoint to a new type. 1. program the characteristics of the required endpoint into the following fields of the usb_diepx_ctl register (for in or bidirectional endpoints) or the usb_doepx_ctl register (for out or bidirectional endpoints). ? maximum packet size ? usb active endpoint = 1 ? endpoint start data toggle (for interrupt and bulk endpoints) ? endpoint type ? txfifo number 2. once the endpoint is activated, the core starts decoding the tokens addressed to that endpoint and sends out a valid handshake for each valid token received for the endpoint. 15.4.4.1.6 endpoint deactivation this section describes the steps required to deactivate an existing endpoint. 1. in the endpoint to be deactivated, clear the usb active endpoint bit in the usb_diepx_ctl register (for in or bidirectional endpoints) or the usb_doepx_ctl register (for out or bidirectional endpoints). 2. once the endpoint is deactivated, the core ignores tokens addressed to that endpoint, resulting in a timeout on the usb.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 283 www.energymicro.com 15.4.4.1.7 device dma/slave mode initialization the application must meed the following conditions to set up the device core to handle traffic. ? in slave mode, usb_gintmsk.nptxfempmsk, and usb_gintmsk.rxflvlmsk must be unset. ? in dma mode, the aforementioned interrupts must be masked. 15.4.4.1.8 transfer stop process when the core is operating as a device, use the following programing sequence if you want to stop any transfers (because of an interrupt from the host, typically a reset). 15.4.4.1.8.1 transfer stop programming flow for in endpoints sequence of operations: 1. disable the in endpoint by programming usb_diep0ctl/usb_diepx_ctl.epdis = 1. 2. wait for the usb_diepx_int.epdisbld interrupt, which indicates that the in endpoint is completely disabled. when the epdisbld interrupt is asserted, the core clears the following bits: ? usb_diep0ctl/usb_diepx_ctl.epdis = 0 ? usb_diep0ctl/usb_diepx_ctl.epena = 0 3. flush the tx fifo by programming the following bits: ? usb_grstctl.txfflsh = 1 ? usb_grstctl.txfnum = fifo number specific to endpoint 4. the application can start polling till usb_grstctl.txfflsh is cleared. when this bit is cleared, it ensures that there is no data left in the tx fifo. 15.4.4.1.8.2 transfer stop programming flow for out endpoints sequence of operations: 1. enable all out endpoints by setting usb_doep0ctl/usb_doepx_ctl.epena = 1. 2. before disabling any out endpoint, the application must enable global out nak mode in the core, according to the instructions in setting the global out nak (p. 291 ) . this ensures that data in the rx fifo is sent to the application successfully. set usb_dctl.usb_dctl.sgoutnak = 1. 3. wait for the usb_gintsts.goutnakeff interrupt. 4. disable all active out endpoints by programming the following register bits: ? usb_doep0ctl/usb_doepx_ctl.epena = 1 ? usb_doep0ctl/usb_doepx_ctl.epdis = 1 ? usb_doep0ctl/usb_doepx_ctl.snak = 1 5. wait for the usb_doep0int/usb_doepx_int.epdisbld interrupt for each out endpoint programmed in the previous step. the usb_doep0int/usb_doepx_int.epdisbld interrupt indicates that the corresponding out endpoint is completely disabled. when the epdisbld interrupt is asserted, the core clears the following bits: ? usb_doep0ctl/usb_doepx_ctl.epena = 0 ? usb_doep0ctl/usb_doepx_ctl.epdis = 0 note the application must not flush the rx fifo, as the global out nak effective interrupt earlier ensures that there is no data left in the rx fifo. 15.4.4.2 device programming operations table 15.2 (p. 284 ) provides links to the programming sequence for different usb transaction types.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 284 www.energymicro.com table 15.2. device mode in setup out control slave generic non-periodic (bulk and control) in data transfers without thresholding in dma and slave mode (p. 308 ) out data transfers in slave and dma modes (p. 285 ) generic non-isochronous out data transfers without thresholding in dma and slave modes (p. 293 ) dma generic non-periodic (bulk and control) in data transfers without thresholding in dma and slave mode (p. 308 ) out data transfers in slave and dma modes (p. 285 ) generic non-isochronous out data transfers without thresholding in dma and slave modes (p. 293 ) bulk slave generic non-periodic (bulk and control) in data transfers without thresholding in dma and slave mode (p. 308 ) generic non-isochronous out data transfers without thresholding in dma and slave modes (p. 293 ) dma generic non-periodic (bulk and control) in data transfers without thresholding in dma and slave mode (p. 308 ) generic non-isochronous out data transfers without thresholding in dma and slave modes (p. 293 ) interrupt slave generic periodic in (interrupt and isochronous) data transfers without thresholding (p. 313 ) and generic periodic in data transfers without thresholding using the periodic transfer interrupt feature (p. 315 ) generic non-isochronous out data transfers without thresholding in dma and slave modes (p. 293 ) and generic interrupt out data transfers without thresholding using periodic transfer interrupt feature (p. 297 ) dma generic periodic in (interrupt and isochronous) data transfers without thresholding (p. 313 ) and generic periodic in data transfers without thresholding using the periodic transfer interrupt feature (p. 315 ) generic non-isochronous out data transfers without thresholding in dma and slave modes (p. 293 ) and generic interrupt out data transfers without thresholding using periodic transfer interrupt feature (p. 297 ) isochronous slave generic periodic in (interrupt and isochronous) data transfers without thresholding (p. 313 ) control read transfers (setup, data in, status out) (p. 288 ) and incomplete isochronous out data transfers
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 285 www.energymicro.com in dma and slave modes (p. 301 ) dma generic periodic in (interrupt and isochronous) data transfers without thresholding (p. 313 ) and generic periodic in data transfers without thresholding using the periodic transfer interrupt feature (p. 315 ) control read transfers (setup, data in, status out) (p. 288 ) and incomplete isochronous out data transfers in dma and slave modes (p. 301 ) 15.4.4.2.1 out data transfers in slave and dma modes this section describes the internal data flow and application-level operations during data out transfers and setup transactions. 15.4.4.2.1.1 control setup transactions this section describes how the core handles setup packets and the application?s sequence for handling setup transactions. to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the host, it must initialize an endpoint as described in endpoint initialization (p. 281 ) . see packet read from fifo in slave mode (p. 290 ) . application requirements 1. to receive a setup packet, the usb_doepx_tsiz.supcnt field in a control out endpoint must be programmed to a non-zero value. when the application programs the supcnt field to a non- zero value, the core receives setup packets and writes them to the receive fifo, irrespective of the usb_doepx_ctl.nak status and usb_doepx_ctl.epena bit setting. the supcnt field is decremented every time the control endpoint receives a setup packet. if the supcnt field is not programmed to a proper value before receiving a setup packet, the core still receives the setup packet and decrements the supcnt field, but the application possibly is not be able to determine the correct number of setup packets received in the setup stage of a control transfer. ? usb_doepx_tsiz.supcnt = 3 2. in dma mode, the out endpoint must also be enabled, to transfer the received setup packet data from the internal receive fifo to the external memory. ? usb_doepx_ctl.epena = 1 3. the application must always allocate some extra space in the receive data fifo, to be able to receive up to three setup packets on a control endpoint. ? the space to be reserved is (4 * n) + 6 dwords, where n is the number of control endpoints supported by the device. three dwords are required for the first setup packet, 1 dword is required for the setup stage done dword, and 6 dwords are required to store two extra setup packets among all control endpoints. ? 3 dwords per setup packet are required to store 8 bytes of setup data and 4 bytes of setup status (setup packet pattern). the core reserves this space in the receive data ? fifo to write setup data only, and never uses this space for data packets. 4. in slave mode, the application must read the 2 dwords of the setup packet from the receive fifo. in dma mode, the core writes the 2 dwords of setup data to the memory. 5. the application must read and discard the setup stage done dword from the receive fifo. internal data flow
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 286 www.energymicro.com 1. when a setup packet is received, the core writes the received data to the receive fifo, without checking for available space in the receive fifo and irrespective of the endpoint?s nak and stall bit settings. ? the core internally sets the in nak and out nak bits for the control in/out endpoints on which the setup packet was received. 2. for every setup packet received on the usb, 3 dwords of data is written to the receive fifo, and the supcnt field is decremented by 1. ? the first dword contains control information used internally by the core ? the second dword contains the first 4 bytes of the setup command ? the third dword contains the last 4 bytes of the setup command 3. when the setup stage changes to a data in/out stage, the core writes an entry (setup stage done dword) to the receive fifo, indicating the completion of the setup stage. 4. on the ahb side, setup packets are emptied either by the dma or the application. in dma mode, the setup packets (2 dwords) are written to the memory location programmed in the usb_doepx_dmaaddr register, only if the endpoint is enabled. if the endpoint is not enabled, the data remains in the receive fifo until the enable bit is set. 5. when either the dma or the application pops the setup stage done dword from the receive fifo, the core interrupts the application with a usb_doepx_int.setup interrupt, indicating it can process the received setup packet. ? the core clears the endpoint enable bit for control out endpoints. application programming sequence 1. program the usb_doepx_tsiz register. ? usb_doepx_tsiz.supcnt = 3 2. in dma mode, program the usb_doepx_dmaaddr register and usb_doepx_ctl register with the endpoint characteristics and set the endpoint enable bit (usb_doepx_ctl.epena). ? endpoint enable = 1 3. in slave mode, wait for the usb_gintsts.rxflvl interrupt and empty the data packets from the receive fifo, as explained in packet read from fifo in slave mode (p. 290 ) . this step can be repeated many times. 4. assertion of the usb_doepx_int.setup interrupt marks a successful completion of the setup data transfer. ? on this interrupt, the application must read the usb_doepx_tsiz register to determine the number of setup packets received and process the last received setup packet. ? in dma mode, the application must also determine if the interrupt bit usb_doepx_int.back2backsetup is set. this bit is set if the core has received more than three back-to-back setup packets. if this is the case, the application must ignore the usb_doepx_tsiz.supcnt value and use the usb_doepx_dmaaddr directly to read out the last setup packet received. usb_doepx_dmaaddr-8 provides the pointer to the last valid setup data. note if the application has not enabled ep0 before the host sends the setup packet, the core acks the setup packet and stores it in the fifo, but does not write to the memory until ep0 is enabled. when the application enables the ep0 (first enable) and clears the nak bit at the same time the host sends data out, the data out is stored in the rxfifo. the otg core then writes the setup data to the memory and disables the endpoint. though the application expects a transfer complete interrupt for the data out phase, this does not occur, because the setup packet, rather than the data out packet, enables ep0 the first time. thus, the data out packet is still in the rxfifo until the application re-enables ep0. the application must enable ep0 one more time for the core to process the data out packet.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 287 www.energymicro.com figure 15.19 (p. 287 ) charts this flow. figure 15.19. processing a setup packet wait for usb _doep x _int.setup rem _supcnt = rd_reg(usb_doepx_tsiz) find set up cm d t ype writ e 2 - st age read no back2back set up int errupt bit set ? set up_addr = rd_reg(usb_doepx_dma yes set up_cm d[ 31:0] = m em [ set up_addr-8] set up _cm d[ 63:32] = m em [ set up_addr-4] set up_cm d[ 31:0] = m em [ 4-2 * rem _supcnt ] set up _cm d[ 63:32] = m em [ 5-2 * rem _supcnt ] ct r-rd/wr/2 st age set up_np_in_pkt dat a in phase set up_np_in_pkt sat a in phase rcv_out _pkt dat a out phase 15.4.4.2.1.2 handling more than three back-to-back setup packets per the usb 2.0 specification, normally, during a setup packet error, a host does not send more than three back-to-back setup packets to the same endpoint. however, the usb 2.0 specification does not limit the number of back-to-back setup packets a host can send to the same endpoint. when this condition occurs, the core generates an interrupt (usb_doepx_int.back2backsetup). in dma mode, the core also rewinds the dma address for that endpoint (usb_doepx_dmaaddr) and overwrites the first setup packet in system memory with the fourth, second with the fifth, and so on. if the back2backsetup interrupt is asserted, the application must read the out endpoint dma register (usb_doepx_dmaaddr) to determine the final setup data in system memory. in dma mode, the application can mask the back2backsetup interrupt, but after receiving the doepint.setup interrupt, the application can read the doepint.back2backsetup interrupt bit. in slave mode, the application can use the usb_gintsts.rxflvl interrupt to read out the setup packets from the fifo whenever the core receives the setup packet. 15.4.4.2.2 control transfers this section describes the various types of control transfers.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 288 www.energymicro.com 15.4.4.2.2.1 control write transfers (setup, data out, status in) this section describes control write transfers. application programming sequence 1. assertion of the usb_doepx_int.setup packet interrupt indicates that a valid setup packet has been transferred to the application. see out data transfers in slave and dma modes (p. 285 ) for more details. at the end of the setup stage, the application must reprogram the usb_doepx_tsiz.supcnt field to 3 to receive the next setup packet. 2. if the last setup packet received before the assertion of the setup interrupt indicates a data out phase, program the core to perform a control out transfer as explained in generic non-isochronous out data transfers without thresholding in dma and slave modes (p. 293 ) . in dma mode, the application must reprogram the usb_doepx_dmaaddr register to receive a control out data packet to a different memory location. 3. in a single out data transfer on control endpoint 0, the application can receive up to 64 bytes. if the application is expecting more than 64 bytes in the data out stage, the application must re-enable the endpoint to receive another 64 bytes, and must continue to do so until it has received all the data in the data stage. 4. assertion of the usb_doepx_int.transfer completed interrupt on the last data out transfer indicates the completion of the data out phase of the control transfer. 5. on completion of the data out phase, the application must do the following. ? to transfer a new setup packet in dma mode, the application must re-enable the control out endpoint as explained in out data transfers in slave and dma modes (p. 285 ) . ? usb_doepx_ctl.epena = 1 ? to execute the received setup command, the application must program the required registers in the core. this step is optional, based on the type of setup command received. 6. for the status in phase, the application must program the core as described in generic non-periodic (bulk and control) in data transfers without thresholding in dma and slave mode (p. 308 ) to perform a data in transfer. 7. assertion of the usb_diepx_int.xfercompl interrupt indicates completion of the status in phase of the control transfer. 8. the previous step must be repeated until the usb_diepx_int.xfercompl interrupt is detected on the endpoint, marking the completion of the control write transfer. 15.4.4.2.2.2 control read transfers (setup, data in, status out) this section describes control read transfers. application programming sequence 1. assertion of the usb_doepx_int.setup packet interrupt indicates that a valid setup packet has been transferred to the application. see out data transfers in slave and dma modes (p. 285 ) for more details. at the end of the setup stage, the application must reprogram the usb_doepx_tsiz.supcnt field to 3 to receive the next setup packet. 2. if the last setup packet received before the assertion of the setup interrupt indicates a data in phase, program the core to perform a control in transfer as explained in generic non-periodic (bulk and control) in data transfers without thresholding in dma and slave mode (p. 308 ) . 3. on a single in data transfer on control endpoint 0, the application can transmit up to 64 bytes. to transmit more than 64 bytes in the data in stage, the application must re-enable the endpoint to transmit another 64 bytes, and must continue to do so, until it has transmitted all the data in the data stage. 4. the previous step must be repeated until the usb_diepx_int.xfercompl interrupt is detected for every in transfer on the endpoint. 5. the usb_diepx_int.xfercompl interrupt on the last in data transfer marks the completion of the control transfer?s data stage.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 289 www.energymicro.com 6. to perform a data out transfer in the status out phase, the application must program the core as described in out data transfers in slave and dma modes (p. 285 ) . ? the application must program the usb_dcfg.nzstsouthshk handshake field to a proper setting before transmitting an data out transfer for the status stage. ? in dma mode, the application must reprogram the usb_doepx_dmaaddr register to receive the control out data packet to a different memory location. 7. assertion of the usb_doepx_int.xfercompl interrupt indicates completion of the status out phase of the control transfer. this marks the successful completion of the control read transfer. ? to transfer a new setup packet in dma mode, the application must re-enable the control out endpoint as explained in out data transfers in slave and dma modes (p. 285 ) . ? usb_doepx_ctl.epena = 1 15.4.4.2.2.3 two-stage control transfers (setup/status in) this section describes two-stage control transfers. application programming sequence 1. assertion of the usb_doepx_int.setup interrupt indicates that a valid setup packet has been transferred to the application. see out data transfers in slave and dma modes (p. 285 ) for more detail. to receive the next setup packet, the application must reprogram the usb_doepx_tsiz.supcnt field to 3 at the end of the setup stage. 2. decode the last setup packet received before the assertion of the setup interrupt. if the packet indicates a two-stage control command, the application must do the following. ? to transfer a new setup packet in dma mode, the application must re-enable the control out endpoint. see out data transfers in slave and dma modes (p. 285 ) for details. ? usb_doepx_ctl.epena = 1 ? depending on the type of setup command received, the application can be required to program registers in the core to execute the received setup command. 3. for the status in phase, the application must program the core described in generic non-periodic (bulk and control) in data transfers without thresholding in dma and slave mode (p. 308 ) to perform a data in transfer. 4. assertion of the usb_diepx_int.xfercompl interrupt indicates the completion of the status in phase of the control transfer. 5. the previous step must be repeated until the usb_diepx_int.xfercompl interrupt is detected on the endpoint, marking the completion of the two-stage control transfer. example: two-stage control transfer these notes refer to figure 15.20 (p. 290 ) . 1. setup packet #1 is received on the usb and is written to the receive fifo, and the core responds with an ack handshake. this handshake is lost and the host detects a timeout. 2. the setup packet in the receive fifo results in a usb_gintsts.rxflvl interrupt to the application, causing the application to empty the receive fifo. 3. setup packet #2 on the usb is written to the receive fifo, and the core responds with an ack handshake. 4. the setup packet in the receive fifo sends the application the usb_gintsts.rxflvl interrupt and the application empties the receive fifo. 5. after the second setup packet, the host sends a control in token for the status phase. the core issues a nak response to this token, and writes a setup stage done entry to the receive fifo. this entry results in a usb_gintsts.rxflvl interrupt to the application, which empties the receive fifo. after reading out the setup stage done dword, the core asserts the usb_doepx_int.setup packet interrupt to the application. 6. on this interrupt, the application processes setup packet #2, decodes it to be a two-stage control command, and clears the control in nak bit.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 290 www.energymicro.com ? usb_diepx_ctl.cnak = 1 7. when the application clears the in nak bit, the core interrupts the application with a usb_diepx_int.intkntxfemp. on this interrupt, the application enables the control in endpoint with a usb_diepx_tsiz.xfersize of 0 and a usb_diepx_tsiz.pktcnt of 1. this results in a zero-length data packet for the status in token on the usb. 8. at the end of the status in phase, the core interrupts the application with a usb_diepx_int.xfercompl interrupt. figure 15.20. two-stage control transfer set up dat a 2 set up dat a 2 h ost ap p lica t ion d e vice usb s e t u p . i n ( s t a t u s ) 8 byt es a c k st at us _ xact _ 2 a c k l o s t r x f l v l i n t r set up _ xact _ 1 n a k i n set up _ xact _ 2 st at us _ xact _ 2 set up dat a 1 s e t u p a c k r x f l v l i n t r n a k i n set up dat a 1 set up done s e t u p i n t r clear in nak i n t k n t x f e m p i n t r x f e r c o m p l i n t r idle unt il int r set up _ in _ np _ pkt s t s d a t a r d y proc _ set up _ pkt # 2 idle unt il int r rcv _ out _ dat a idle unt il int r rcv _ out _ dat a idle unt il int r rcv _ out _ dat a idle unt il int r 1 3 4 r x f l v l i n t r 5 6 7 8 ct l - in nak = 1 ct l - out nak = 1 cont rol in nak = 1 cont rol out nak = 1 8 byt es 8 byt es set up dat a 1 xfersize = 0 byt es pktcnt = 1 epena = 1 15.4.4.2.2.4 packet read from fifo in slave mode this section describes how to read packets (out data and setup packets) from the receive fifo in slave mode. 1. on catching a usb_gintsts.rxflvl interrupt, the application must read the receive status pop register (usb_grxstsp). 2. the application can mask the usb_gintsts.rxflvl interrupt by writing to usb_gintmsk.rxflvl = 0, until it has read the packet from the receive fifo. 3. if the received packet?s byte count is not 0, the byte count amount of data is popped from the receive data fifo and stored in memory. if the received packet byte count is 0, no data is popped from the receive data fifo. 4. the receive fifo?s packet status readout indicates one of the following. 5. global out nak pattern: pktsts = global out nak, bcnt = 0x000, epnum = dont care (0x0), dpid = dont care (0b00). this data indicates that the global out nak bit has taken effect.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 291 www.energymicro.com a. setup packet pattern: pktsts = setup, bcnt = 0x008, epnum = control ep num, dpid = d0. this data indicates that a setup packet for the specified endpoint is now available for reading from the receive fifo. b. setup stage done pattern: pktsts = setup stage done, bcnt = 0x0, epnum = control ep num, dpid = don?t care (0b00). this data indicates that the setup stage for the specified endpoint has completed and the data stage has started. after this entry is popped from the receive fifo, the core asserts a setup interrupt on the specified control out endpoint. c. data out packet pattern: pktsts = dataout, bcnt = size of the received data out packet, epnum = epnum on which the packet was received, dpid = actual data pid. d. data transfer completed pattern: pktsts = data out transfer done, bcnt = 0x0, epnum = out ep num on which the data transfer is complete, dpid = dont care (0b00). this data indicates that a out data transfer for the specified out endpoint has completed. after this entry is popped from the receive fifo, the core asserts a transfer completed interrupt on the specified out endpoint. the encoding for the pktsts is listed in section 15.6 (p. 349 ) . 6. after the data payload is popped from the receive fifo, the usb_gintsts.rxflvl interrupt must be unmasked. 7. steps 1?5 are repeated every time the application detects assertion of the interrupt line due to usb_gintsts.rxflvl. reading an empty receive fifo can result in undefined core behavior. figure 15.21 (p. 291 ) provides a flow chart of this procedure. figure 15.21. receive fifo packet read in slave mode n wait unt il usb_gintsts.rxflvl packet st ore in m em ory y m em [ 0:dword_cnt -1] = rd _rxfifo(rd_dat a.epnum, dword _cnt ) rd_dat a.bcnt = 0 rd_dat a = rd_reg(usb_rxstsp) rcv_out _pkt () dword_cnt = bcnt [ 11:2] + ( bcnt[ 1] | bcnt[ 0] ) 15.4.4.2.2.5 setting the global out nak internal data flow 1. when the application sets the global out nak (usb_dctl.sgoutnak), the core stops writing data, except setup packets, to the receive fifo. irrespective of the space availability in the receive fifo, non-isochronous out tokens receive a nak handshake response, and the core ignores isochronous out data packets 2. the core writes the global out nak pattern to the receive fifo. the application must reserve enough receive fifo space to write this data pattern. see data fifo ram allocation (p. 327 ) . 3. when either the core (in dma mode) or the application (in slave mode) pops the global out nak pattern dword from the receive fifo, the core sets the usb_gintsts.goutnakeff interrupt.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 292 www.energymicro.com 4. once the application detects this interrupt, it can assume that the core is in global out nak mode. the application can clear this interrupt by clearing the usb_dctl.sgoutnak bit. application programming sequence 1. to stop receiving any kind of data in the receive fifo, the application must set the global out nak bit by programming the following field. ? usb_dctl.sgoutnak = 1 2. wait for the assertion of the interrupt usb_gintsts.goutnakeff. when asserted, this interrupt indicates that the core has stopped receiving any type of data except setup packets. 3. the application can receive valid out packets after it has set usb_dctl.sgoutnak and before the core asserts the usb_gintsts.goutnakeff interrupt. 4. the application can temporarily mask this interrupt by writing to the usb_gintmsk.goutnakeffmsk bit. ? usb_gintmsk.ginnakeffmsk = 0 5. whenever the application is ready to exit the global out nak mode, it must clear the usb_dctl.sgoutnak bit. this also clears the usb_gintsts.goutnakeff interrupt. ? usb_dctl.cgoutnak = 1 6. if the application has masked this interrupt earlier, it must be unmasked as follows: ? usb_gintmsk.goutnakeffmsk = 1 15.4.4.2.2.6 disabling an out endpoint the application must use this sequence to disable an out endpoint that it has enabled. application programming sequence 1. before disabling any out endpoint, the application must enable global out nak mode in the core, as described in setting the global out nak (p. 291 ) . ? usb_dctl.sgoutnak = 1 ? wait for the usb_gintsts.goutnakeff interrupt 2. disable the required out endpoint by programming the following fields. ? usb_doepx_ctl.epdis = 1 ? usb_doepx_ctl.snak = 1 3. wait for the usb_doepx_int.epdisbld interrupt, which indicates that the out endpoint is completely disabled. when the epdisbld interrupt is asserted, the core also clears the following bits. ? usb_doepx_ctl.epdis = 0 ? usb_doepx_ctl.epena = 0 4. the application must clear the global out nak bit to start receiving data from other non-disabled out endpoints. ? usb_dctl.sgoutnak = 0 15.4.4.2.2.7 stalling a non-isochronous out endpoint this section describes how the application can stall a non-isochronous endpoint. 1. put the core in the global out nak mode, as described in setting the global out nak (p. 291 ) . 2. disable the required endpoint, as described in section 15.4.4.2.2.6 (p. 292 ) . ? when disabling the endpoint, instead of setting the usb_doepx_ctl.snak bit, set usb_doepx_ctl.stall = 1. ? the stall bit always takes precedence over the nak bit. 3. when the application is ready to end the stall handshake for the endpoint, the usb_doepx_ctl.stall bit must be cleared.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 293 www.energymicro.com 4. if the application is setting or clearing a stall for an endpoint due to a setfeature.endpoint halt or clearfeature.endpoint halt command, the stall bit must be set or cleared before the application sets up the status stage transfer on the control endpoint. 15.4.4.2.2.8 generic non-isochronous out data transfers in dma and slave modes to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the host, it must initialize an endpoint as described in endpoint initialization (p. 281 ) . see packet read from fifo in slave mode (p. 290 ) . this section describes a regular non-isochronous out data transfer (control, bulk, or interrupt). application requirements 1. before setting up an out transfer, the application must allocate a buffer in the memory to accommodate all data to be received as part of the out transfer, then program that buffer?s size and start address (in dma mode) in the endpoint-specific registers. 1. for out transfers, the transfer size field in the endpoint?s transfer size register must be a multiple of the maximum packet size of the endpoint, adjusted to the dword boundary. if (mps[epnum] mod 4) == 0 transfer size[epnum] = n * (mps[epnum]) //dword aligned else transfer size[epnum] = n * (mps[epnum] + 4 - (mps[epnum] mod 4)) //non dword aligned packet count[epnum] = n n > 0 2. in dma mode, the core stores a received data packet in the memory, always starting on a dword boundary. if the maximum packet size of the endpoint is not a multiple of 4, the core inserts byte pads at end of a maximum-packet-size packet up to the end of the dword. 3. on any out endpoint interrupt, the application must read the endpoint?s transfer size register to calculate the size of the payload in the memory. the received payload size can be less than the programmed transfer size. ? payload size in memory = application-programmed initial transfer size ? core updated final transfer size ? number of usb packets in which this payload was received = application-programmed initial packet count ? core updated final packet count internal data flow 1. the application must set the transfer size and packet count fields in the endpoint-specific registers, clear the nak bit, and enable the endpoint to receive the data. 2. once the nak bit is cleared, the core starts receiving data and writes it to the receive fifo, as long as there is space in the receive fifo. for every data packet received on the usb, the data packet and its status are written to the receive fifo. every packet (maximum packet size or short packet) written to the receive fifo decrements the packet count field for that endpoint by 1. ? out data packets received with bad data crc are flushed from the receive fifo automatically. ? after sending an ack for the packet on the usb, the core discards non-isochronous out data packets that the host, which cannot detect the ack, re-sends. the application does not detect multiple back-to-back data out packets on the same endpoint with the same data pid. in this case the packet count is not decremented. ? if there is no space in the receive fifo, isochronous or non-isochronous data packets are ignored and not written to the receive fifo. additionally, non-isochronous out tokens receive a nak handshake reply.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 294 www.energymicro.com ? in all the above three cases, the packet count is not decremented because no data is written to the receive fifo. 3. when the packet count becomes 0 or when a short packet is received on the endpoint, the nak bit for that endpoint is set. once the nak bit is set, the isochronous or non-isochronous data packets are ignored and not written to the receive fifo, and non-isochronous out tokens receive a nak handshake reply. 4. after the data is written to the receive fifo, either the application (in slave mode) or the core?s dma engine (in dma mode), reads the data from the receive fifo and writes it to external memory, one packet at a time per endpoint. 5. at the end of every packet write on the ahb to external memory, the transfer size for the endpoint is decremented by the size of the written packet. 6. the out data transfer completed pattern for an out endpoint is written to the receive fifo on one of the following conditions. ? the transfer size is 0 and the packet count is 0 ? the last out data packet written to the receive fifo is a short packet (0 <= packet size < maximum packet size) 7. when either the application or the dma pops this entry (out data transfer completed), a transfer completed interrupt is generated for the endpoint and the endpoint enable is cleared. application programming sequence 1. program the usb_doepx_tsiz register for the transfer size and the corresponding packet count. additionally, in dma mode, program the usb_doepx_dmaaddr register. 2. program the usb_doepx_ctl register with the endpoint characteristics, and set the endpoint enable and clearnak bits. ? usb_doepx_ctl.epena = 1 ? usb_doepx_ctl.cnak = 1 3. in slave mode, wait for the usb_gintsts.rxflvl level interrupt and empty the data packets from the receive fifo as explained in packet read from fifo in slave mode (p. 290 ) . ? this step can be repeated many times, depending on the transfer size. 4. asserting the usb_doepx_int.xfercompl interrupt marks a successful completion of the non- isochronous out data transfer. 5. read the usb_doepx_tsiz register to determine the size of the received data payload. note the xfersize is not decremented for the last packet. this is as per design behavior. slave mode bulk out transaction figure 15.22 (p. 295 ) depicts the reception of a single bulk out data packet from the usb to the ahb and describes the events involved in the process.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 295 www.energymicro.com figure 15.22. slave mode bulk out transaction in it _ ou t _ e p h ost d e vice usb o u t a c k rxflvl intr wr_reg(usb_doepx_tsiz) wr_reg(usb_doepx_ctl) 512 byt es o u t n a k xact _ 1 ap p lica t io n x f e r c o m p i n t r _ d o e p x _ c t n a k = 1 x f e r s i z e = 0 idle unt il int r rcv _ out _ pkt () idle unt il int r on new xfer or rxfifo not em pt y 1 2 3 4 5 6 7 8 xfersize = 512 byt es pktcnt = 1 epena = 1 cnak = 1 b s u l pktcnt = 0 after a setconfiguration/setinterface command, the application initializes all out endpoints by setting usb_doepx_ctl.cnak = 1 and usb_doepx_ctl.epena = 1, and setting a suitable xfersize and pktcnt in the usb_doepx_tsiz register. 1. host attempts to send data (out token) to an endpoint. 2. when the core receives the out token on the usb, it stores the packet in the rxfifo because space is available there. 3. after writing the complete packet in the rxfifo, the core then asserts the usb_gintsts.rxflvl interrupt. 4. on receiving the pktcnt number of usb packets, the core sets the nak bit for this endpoint internally to prevent it from receiving any more packets. 5. the application processes the interrupt and reads the data from the rxfifo. 6. when the application has read all the data (equivalent to xfersize), the core generates a usb_doepx_int.xfercompl interrupt. 7. the application processes the interrupt and uses the setting of the usb_doepx_int.xfercompl interrupt bit to determine that the intended transfer is complete. 15.4.4.2.2.9 generic isochronous out data transfer in dma and slave modes to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the host, it must initialize an endpoint as described in endpoint initialization (p. 281 ) . see packet read from fifo in slave mode (p. 290 ) . this section describes a regular isochronous out data transfer. application requirements: 1. all the application requirements for non-isochronous out data transfers also apply to isochronous out data transfers 2. for isochronous out data transfers, the transfer size and packet count fields must always be set to the number of maximum-packet-size packets that can be received in a single frame and no more. isochronous out data transfers cannot span more than 1 frame. ? 1 <= packet count[epnum] <= 3
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 296 www.energymicro.com 3. in slave mode, when isochronous out endpoints are supported in the device, the application must read all isochronous out data packets from the receive fifo (data and status) before the end of the periodic frame (usb_gintsts.eopf interrupt). in dma mode, the application must guarantee enough bandwidth to allow emptying the isochronous out data packet from the receive fifo before the end of each periodic frame. 4. to receive data in the following frame, an isochronous out endpoint must be enabled after the usb_gintsts.eopf and before the usb_gintsts.sof. internal data flow 1. the internal data flow for isochronous out endpoints is the same as that for non-isochronous out endpoints, but for a few differences. 2. when an isochronous out endpoint is enabled by setting the endpoint enable and clearing the nak bits, the even/odd frame bit must also be set appropriately. the core receives data on a isochronous out endpoint in a particular frame only if the following condition is met. ? usb_doepx_ctl.dpideof (even/odd frame) = usb_dsts.soffn[0] 3. when either the application or the internal dma completely reads an isochronous out data packet (data and status) from the receive fifo, the core updates the usb_doepx_tsiz.rxdpidsupcnt (received dpid) field with the data pid of the last isochronous out data packet read from the receive fifo. application programming sequence 1. program the usb_doepx_tsiz register for the transfer size and the corresponding packet count. when in dma mode, also program the usb_doepx_dmaaddr register. 2. program the usb_doepx_ctl register with the endpoint characteristics and set the endpoint enable, clearnak, and even/odd frame bits. ? endpoint enable = 1 ? cnak = 1 ? even/odd frame = (0: even/1: odd) 1. in slave mode, wait for the usb_gintsts.rx stsq level interrupt and empty the data packets from the receive fifo as explained in packet read from fifo in slave mode (p. 290 ) . ? this step can be repeated many times, depending on the transfer size. 1. the assertion of the usb_doepx_int.xfercompl interrupt marks the completion of the isochronous out data transfer. this interrupt does not necessarily mean that the data in memory is good. 2. this interrupt can not always be detected for isochronous out transfers. instead, the application can detect the usb_gintsts.incomplp (incomplete isochronous out data) interrupt. see incomplete isochronous out data transfers in dma and slave modes (p. 301 ) , for more details 3. read the usb_doepx_tsiz register to determine the size of the received transfer and to determine the validity of the data received in the frame. the application must treat the data received in memory as valid only if one of the following conditions is met. ? usb_doepx_tsiz.rxdpid = d0 and the number of usb packets in which this payload was received = 1 ? usb_doepx_tsiz.rxdpid = d1 and the number of usb packets in which this payload was received = 2 ? usb_doepx_tsiz.rxdpid = d2 and the number of usb packets in which this payload was received = 3 ? the number of usb packets in which this payload was received = app programmed initial packet count ? core updated final packet count the application can discard invalid data packets.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 297 www.energymicro.com 15.4.4.2.2.10 generic interrupt out data transfers using periodic transfer interrupt feature this section describes a regular intr out data transfer with the periodic transfer interrupt feature. to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the host, it must initialize an endpoint as described in endpoint initialization (p. 281 ) . see packet read from fifo in slave mode (p. 290 ) . application requirements 1. before setting up a periodic out transfer, the application must allocate a buffer in the memory to accommodate all data to be received as part of the out transfer, then program that buffer?s size and start address in the endpoint-specific registers. 2. for interrupt out transfers, the transfer size field in the endpoint?s transfer size register must be a multiple of the maximum packet size of the endpoint, adjusted to the dword boundary. the transfer size programmed can span across multiple frames based on the periodicity after which the application want to receive the usb_doepx_int.xfercompl interrupt ? transfer size[epnum] = n * (mps[epnum] + 4 - (mps[epnum] mod 4)) ? packet count[epnum] = n ? n > 0 (higher value of n reduces the periodicity of the usb_doepx_int.xfercompl interrupt) ? 1 < packet count[epnum] < n (higher value of n reduces the periodicity of the usb_doepx_int.xfercompl interrupt) 3. in dma mode, the core stores a received data packet in the memory, always starting on a dword boundary. if the maximum packet size of the endpoint is not a multiple of 4, the core inserts byte pads at end of a maximum-packet-size packet up to the end of the dword. the application will not be informed about the frame number on which a specific packet has been received. 4. on usb_doepx_int.xfercompl interrupt, the application must read the endpoint?s transfer size register to calculate the size of the payload in the memory. the received payload size can be less than the programmed transfer size. ? payload size in memory = application-programmed initial transfer size ? core updated final transfer size ? number of usb packets in which this payload was received = application-programmed initial packet count ? core updated final packet count. ? if for some reason, the host stops sending tokens, there are no interrupts to the application, and the application must timeout on its own. 5. the assertion of the usb_doepx_int.xfercompl interrupt marks the completion of the interrupt out data transfer. this interrupt does not necessarily mean that the data in memory is good. 6. read the usb_doepx_tsiz register to determine the size of the received transfer and to determine the validity of the data received in the frame. internal data flow 1. the application must set the transfer size and packet count fields in the endpoint-specific registers, clear the nak bit, and enable the endpoint to receive the data. ? the application must enable the usb_dctl.ignrfrmnum 2. when an interrupt out endpoint is enabled by setting the endpoint enable and clearing the nak bits, the even/odd frame will be ignored by the core. 1. once the nak bit is cleared, the core starts receiving data and writes it to the receive fifo, as long as there is space in the receive fifo. for every data packet received on the usb, the data packet and its status are written to the receive fifo. every packet (maximum packet size or short packet) written to the receive fifo decrements the packet count field for that endpoint by 1. ? out data packets received with bad data crc or any packet error are flushed from the receive fifo automatically. ? interrupt packets with pid errors are not passed to application. core discards the packet, sends ack and does not decrement packet count.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 298 www.energymicro.com ? if there is no space in the receive fifo, interrupt data packets are ignored and not written to the receive fifo. additionally, interrupt out tokens receive a nak handshake reply. 2. when the packet count becomes 0 or when a short packet is received on the endpoint, the nak bit for that endpoint is set. once the nak bit is set, the isochronous or interrupt data packets are ignored and not written to the receive fifo, and interrupt out tokens receive a nak handshake reply. 3. after the data is written to the receive fifo, the core?s dma engine reads the data from the receive fifo and writes it to external memory, one packet at a time per endpoint. 4. at the end of every packet write on the ahb to external memory, the transfer size for the endpoint is decremented by the size of the written packet. 5. the out data transfer completed pattern for an out endpoint is written to the receive fifo on one of the following conditions. ? the transfer size is 0 and the packet count is 0. ? the last out data packet written to the receive fifo is a short packet (0 < packet size < maximum packet size) 6. when either the application or the dma pops this entry (out data transfer completed), a transfer completed interrupt is generated for the endpoint and the endpoint enable is cleared. 15.4.4.2.2.11 generic isochronous out data transfers using periodic transfer interrupt feature this section describes a regular isochronous out data transfer with the periodic transfer interrupt feature. to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the host, it must initialize an endpoint as described in endpoint initialization (p. 281 ) . for packet writes in slave mode, see: packet read from fifo in slave mode (p. 290 ) . application requirements 1. before setting up isoc out transfers spanned across multiple frames, the application must allocate buffer in the memory to accommodate all data to be received as part of the out transfers, then program that buffer?s size and start address in the endpoint-specific registers. ? the application must mask the usb_gintsts.incomplp (incomplete iso out). ? the application must enable the usb_dctl.ignrfrmnum 2. for isoc transfers, the transfer size field in the usb_doepx_tsiz.xfersize register must be a multiple of the maximum packet size of the endpoint, adjusted to the dword boundary. the transfer size programmed can span across multiple frames based on the periodicity after which the application wants to receive the usb_doepx_int.xfercompl interrupt ? transfer size[epnum] = n * (mps[epnum] + 4 - (mps[epnum] mod 4)) ? packet count[epnum] = n ? n > 0 (higher value of n reduces the periodicity of the usb_doepx_int.xfercompl interrupt) ? 1 =< packet count[epnum] =< n (higher value of n reduces the periodicity of the usb_doepx_int.xfercompl interrupt). 3. in dma mode, the core stores a received data packet in the memory, always starting on a dword boundary. if the maximum packet size of the endpoint is not a multiple of 4, the core inserts byte pads at end of a maximum-packet-size packet up to the end of the dword. the application will not be informed about the frame number and the pid value on which a specific out packet has been received. 4. the assertion of the usb_doepx_int.xfercompl interrupt marks the completion of the isochronous out data transfer. this interrupt does not necessarily mean that the data in memory is good. ? on usb_doepx_int.xfercompl, the application must read the endpoint?s transfer size register to calculate the size of the payload in the memory. ? payload size in memory = application-programmed initial transfer size - core updated final transfer size
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 299 www.energymicro.com ? number of usb packets in which this payload was received = application-programmed initial packet count ? core updated final packet count. ? if for some reason, the host stop sending tokens, there will be no interrupt to the application, and the application must timeout on its own. 5. the assertion of the usb_doepx_int.xfercompl can also mark a packet drop on usb due to unavailability of space in the rxfifo or due to any packet errors. ? the application must read the usb_doepx_int.pktdrpsts (usb_doepx_int.bit[11] is now used as the usb_doepx_int.pktdrpsts) register to differentiate whether the usb_doepx_int.xfercompl was generated due to the normal end of transfer or due to dropped packets. in case of packets being dropped on the usb due to unavailability of space in the rxfifo or due to any packet errors the endpoint enable bit is cleared. ? in case of packet drop on the usb application must re-enable the endpoint after recalculating the values usb_doepx_tsiz.xfersize and usb_doepx_tsiz.pktcnt. ? payload size in memory = application-programmed initial transfer size - core updated final transfer size ? number of usb packets in which this payload was received = application-programmed initial packet count - core updated final packet count. note due to application latencies it is possible that doepint.xfercompl interrupt is generated without doepint.pktdrpsts being set, this scenario is possible only if back- to-back packets are dropped for consecutive frames and the pktdrpsts is merged, but the xfersize and pktcnt values for the endpoint are nonzero. in this case, the application must proceed further by programming the pktcnt and xfersize register for the next frame, as it would if pktdrpsts were being set. figure 15.23 (p. 300 ) gives the application flow for isochronous out periodic transfer interrupt feature.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 300 www.energymicro.com figure 15.23. isoc out application flow for periodic transfer interrupt feature n ot e : 1 . th e ( m icr o - ) f r a m e n u m b e r a n d pid f ie ld a r e n ot u p d a t e d f or pe r iod ic out p a ck e t s 2 . in pe r iod ic out t r a n sf e r s , a n y sh or t p a ck e t r e su lt s in a n x f e r com p le t e in t e r r u p t a n d d isa b le s t h e e n d p oin t . th e a p p lica t ion m u st r e e n a b le t h e e n d p oin t w it h r e ca lcu la t e d va lu e s of x f e r size a n d pk t cn t 3 . th e a p p lica t ion m u st r e e n a b le t h e e n d p oin t a f t e r d r op p e d p a ck e t s f or isoc ou start program t he dma address start ad d r e ss of t h e d a t a m e m or y program xfer _ size regist er usb_doepx_tsiz . xfersize = x f e r size sp a n n in g a cr oss m u lt ip le x f e r s usb_doepx_tsiz . .pktcnt = pr og r a m pk t cn t f or m u lt ip le x f e r s program t he global int sts gintmsk. . incomplpmsk = 0 // m a sk in com p isocout in t e r r u p t int ialize variables alloca t e a b u f f e r in t h e syst e m m e m or y f or m u lt ip le x f e r s . bu f f e r size m u st b e a m u lt ip le of m a xpk t size . program ep ct rl regist er t o st art t he xfer usb_doepx_ctl . cnak = 1 usb_doepx_ctl . epena = 1 = 0 = 0 wait for usb_doepx_int. xfercompl int errupt and report error if t im eout expires if usb_doepx_tsiz. xfersize = = 0 if usb_doepx_int. pktdrpsts = = 1 yes end of transfer if usb_doepx_tsiz. pktcnt = = 0 yes ret urn no isoc out pkt drop yes no if usb_doepx_tsiz. xfersize ! = 0 received short packet yes received short packet no re - com put e xfersize and error no usb_doepx_ctl . snak usb_doepx_ctl . epdis usb_ doep x_ dma = p ktcnt internal data flow 1. the application must set the transfer size, packets to be received in a frame and packet count fields in the endpoint-specific registers, clear the nak bit, and enable the endpoint to receive the data. 2. when an isochronous out endpoint is enabled by setting the endpoint enable and clearing the nak bits, the even/odd frame will be ignored by the core. 3. once the nak bit is cleared, the core starts receiving data and writes it to the receive fifo, as long as there is space in the receive fifo. for every data packet received on the usb, the data packet and its status are written to the receive fifo. every packet (maximum packet size or short packet) written to the receive fifo decrements the packet count field for that endpoint by 1. 4. when the packet count becomes 0 or when a short packet is received on the endpoint, the nak bit for that endpoint is set. once the nak bit is set, the isoc packets are ignored and not written to the receive fifo. 5. after the data is written to the receive fifo, the core?s dma engine, reads the data from the receive fifo and writes it to external memory, one packet at a time per endpoint. 6. at the end of every packet write on the ahb to external memory, the transfer size for the endpoint is decremented by the size of the written packet. 7. the out data transfer completed pattern for an out endpoint is written to the receive fifo on one of the following conditions. ? the transfer size is 0 and the packet count is 0
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 301 www.energymicro.com ? the last out data packet written to the receive fifo is a short packet (0 < packet size < maximum packet size). 8. when the dma pops this entry (out data transfer completed), a transfer completed interrupt is generated for the endpoint or the endpoint enable is cleared. 9. out data packets received with bad data crc or any packet error are flushed from the receive fifo automatically. ? in these two cases, the packet count and transfer size registers are not decremented because no data is written to the receive fifo. figure 15.24. isochronous out core internal flow for periodic transfer interrupt feature if (usb_doepx_ctl.cnak = 0b1) & & ( usb _ doepx _ ctl . epena = 0 b 1 ) & & ( dctl . ignrfrmnum = 0 b 1 ) & & n ote 1 . cor e w ill w r it e d a t a t o on ly d w ord alig n e d a d d r e sse s 2 . cor e w ill n ot t a g pe r iod ic out pa ck e t s w it h ( m icr o ) f r a m e n u m b e r a n d pid 3 . an y sh or t pa ck e t ( sp ) re ce ive d w ill g e n e r a t e x f e r com p le t e in t e r r u p t in clu d in g ze r o le n g t h p a ck e t 4 . pa ck e t d r op d u e t o u n ava ila b ilit y of sp a ce in rxfif o w ill g e n e r a t e x f e r com p le t e im m e d ia t e ly . 5 . pk t d r op d u e t o en d poin t b e in g d isa b le d w ill g e n e r a t e x f e r com p le t e a t en d of p e r iod ic fr a m e in t e r va l . start out tok e n fr om h ost ch e ck rx fif o sp a ce ava ila b le ret urn receive pkt and st ore in rxfifo pkt cnt = pkt cnt - 1 dma pop rxfifo xfersize = xfersize - maxpkt size pkt size = = m a xpk t size no received short packet pkt cnt = pkt cnt - 1 no if pk t cn t = = 0 & & x f e r size = = 0 usb_ doep x_ int .xfercompl = 1 dma pop rxfifo xfersize = xfersize - act pkt size yes yes if en d of pe r fr in t & & isoc ou t pa ck e t n a k e d disable endpoint yes no yes yes a no no a yes disable endpoint no 15.4.4.2.2.12 incomplete isochronous out data transfers in dma and slave modes to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the host, it must initialize an endpoint as described in endpoint initialization (p. 281 ) . see packet read from fifo in slave mode (p. 290 ) . this section describes the application programming sequence when isochronous out data packets are dropped inside the core. internal data flow 1. for isochronous out endpoints, the usb_doepx_int.xfercompl interrupt possibly is not always asserted. if the core drops isochronous out data packets, the application could fail to detect the usb_doepx_int.xfercompl interrupt under the following circumstances. ? when the receive fifo cannot accommodate the complete iso out data packet, the core drops the received iso out data. ? when the isochronous out data packet is received with crc errors ? when the isochronous out token received by the core is corrupted ? when the application is very slow in reading the data from the receive fifo
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 302 www.energymicro.com 2. when the core detects an end of periodic frame before transfer completion to all isochronous out endpoints, it asserts the usb_gintsts.incomplp (incomplete isochronous out data) interrupt, indicating that a usb_doepx_int.xfercompl interrupt is not asserted on at least one of the isochronous out endpoints. at this point, the endpoint with the incomplete transfer remains enabled, but no active transfers remains in progress on this endpoint on the usb. 3. this step is applicable only if the core is operating in slave mode. application programming sequence 4. this step is applicable only if the core is operating in slave mode. asserting the usb_gintsts.incomplp (incomplete isochronous out data) interrupt indicates that in the current frame, at least one isochronous out endpoint has an incomplete transfer. 5. if this occurs because isochronous out data is not completely emptied from the endpoint, the application must ensure that the dma or the application empties all isochronous out data (data and status) from the receive fifo before proceeding. ? when all data is emptied from the receive fifo, the application can detect the usb_doepx_int.xfercompl interrupt. in this case, the application must re-enable the endpoint to receive isochronous out data in the next frame, as described in control read transfers (setup, data in, status out) (p. 288 ) . 6. when it receives a usb_gintsts.incomplete isochronous out data interrupt, the application must read the control registers of all isochronous out endpoints (usb_doepx_ctl) to determine which endpoints had an incomplete transfer in the current frame. an endpoint transfer is incomplete if both the following conditions are met. ? usb_doepx_ctl.dpideof (even/odd frame) = usb_dsts.soffn[0] ? usb_doepx_ctl.epena (endpoint enable) = 1 7. the previous step must be performed before the usb_gintsts.sof interrupt is detected, to ensure that the current frame number is not changed. 8. for isochronous out endpoints with incomplete transfers, the application must discard the data in the memory and disable the endpoint by setting the usb_doepx_ctl.epdis (endpoint disable) bit. 9. wait for the usb_doepx_int.epdis (endpoint disabled) interrupt and enable the endpoint to receive new data in the next frame as explained in control read transfers (setup, data in, status out) (p. 288 ) . ? because the core can take some time to disable the endpoint, the application possibly is not able to receive the data in the next frame after receiving bad isochronous data. 15.4.4.2.3 in data transfers in slave and dma modes this section describes the internal data flow and application-level operations during in data transfers. ? packet write in slave mode (p. 303 ) ? setting global non-periodic in endpoint nak (p. 303 ) ? setting in endpoint nak (p. 303 ) ? in endpoint disable (p. 304 ) ? bulk in stall (p. 305 ) ? incomplete isochronous in data transfers (p. 305 ) ? stalling non-isochronous in endpoints (p. 306 ) ? worst-case response time (p. 307 ) ? choosing the value of usb_gusbcfg.usbtrdtim (p. 307 ) ? handling babble conditions (p. 308 ) ? generic non-periodic (bulk and control) in data transfers without thresholding in dma and slave mode (p. 308 ) ? examples (p. 310 ) ? ? generic periodic in data transfers without thresholding using the periodic transfer interrupt feature (p. 315 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 303 www.energymicro.com 15.4.4.2.3.1 packet write in slave mode this section describes how the application writes data packets to the endpoint fifo in slave mode. 1. the application can either choose polling or interrupt mode. ? in polling mode, application monitors the status of the endpoint transmit data fifo, by reading the usb_diepx_txfsts register, to determine, if there is enough space in the data fifo. ? in interrupt mode, application waits for the usb_diepx_int.txfemp interrupt and then reads the usb_diepx_txfsts register, to determine, if there is enough space in the data fifo. ? to write a single non-zero length data packet, there must be space to write the entire packet is the data fifo. ? for writing zero length packet, application must not look for fifo space. 2. using one of the above mentioned methods, when the application determines that there is enough space to write a transmit packet, the application must first write into the endpoint control register, before writing the data into the data fifo. the application, typically must do a read modify write on the usb_diepx_ctl, to avoid modifying the contents of the register, except for setting the endpoint enable bit. the application can write multiple packets for the same endpoint, into the transmit fifo, if space is available. for periodic in endpoints, application must write packets only for one frame. it can write packets for the next periodic transaction, only after getting transfer complete for the previous transaction. 15.4.4.2.3.2 setting global non-periodic in endpoint nak internal data flow 1. when the application sets the global non-periodic in nak bit (usb_dctl.sgnpinnak), the core stops transmitting data on the non-periodic endpoint, irrespective of data availability in the non- periodic transmit fifo. 2. non-isochronous in tokens receive a nak handshake reply 3. the core asserts the usb_gintsts.ginnakeff interrupt in response to the usb_dctl.sgnpinnak bit. 4. once the application detects this interrupt, it can assume that the core is in the global non-periodic in nak mode. the application can clear this interrupt by clearing the usb_dctl.sgnpinnak bit. application programming sequence 1. to stop transmitting any data on non-periodic in endpoints, the application must set the usb_dctl.sgnpinnak bit. to set this bit, the following field must be programmed ? usb_dctl.sgnpinnak = 1 2. wait for the assertion of the usb_gintsts.ginnakeff interrupt. this interrupt indicates the core has stopped transmitting data on the non-periodic endpoints. 3. the core can transmit valid non-periodic in data after the application has set the usb_dctl.sgnpinnak bit, but before the assertion of the usb_gintsts.ginnakeff interrupt. 4. the application can optionally mask this interrupt temporarily by writing to the usb_gintmsk.ginnakeffmsk bit. ? usb_gintmsk.ginnakeffmsk = 0 5. to exit global non-periodic in nak mode, the application must clear the usb_dctl.sgnpinnak. this also clears the usb_gintsts.ginnakeff interrupt. ? usb_dctl.sgnpinnak = 1 6. if the application has masked this interrupt earlier, it must be unmasked as follows: ? usb_gintmsk.ginnakeffmsk = 1 15.4.4.2.3.3 setting in endpoint nak internal data flow
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 304 www.energymicro.com 1. when the application sets the in nak for a particular endpoint, the core stops transmitting data on the endpoint, irrespective of data availability in the endpoint?s transmit fifo. 2. non-isochronous in tokens receive a nak handshake reply ? isochronous in tokens receive a zero-data-length packet reply 3. the core asserts the usb_diepx_int.inepnakeff (in nak effective) interrupt in response to the usb_diepx_ctl.snak (set nak) bit. 4. once this interrupt is seen by the application, the application can assume that the endpoint is in in nak mode. this interrupt can be cleared by the application by setting the usb_diepx_ctl. clear nak bit. application programming sequence 1. to stop transmitting any data on a particular in endpoint, the application must set the in nak bit. to set this bit, the following field must be programmed. ? usb_diepx_ctl.snak = 1 2. wait for assertion of the usb_diepx_int.inepnakeff (nak effective) interrupt. this interrupt indicates the core has stopped transmitting data on the endpoint. 3. the core can transmit valid in data on the endpoint after the application has set the nak bit, but before the assertion of the nak effective interrupt. 4. the application can mask this interrupt temporarily by writing to the usb_diepmsk.inepnakeffmsk (nak effective) bit. ? usb_diepmsk.inepnakeffmsk (nak effective) = 0 5. to exit endpoint nak mode, the application must clear the usb_diepx_ctl.nak status. this also clears the usb_diepx_int.inepnakeff (nak effective) interrupt. ? usb_diepx_ctl.cnak = 1 6. if the application masked this interrupt earlier, it must be unmasked as follows: ? usb_diepmsk.inepnakeffmsk (nak effective) = 1 15.4.4.2.3.4 in endpoint disable use the following sequence to disable a specific in endpoint (periodic/non-periodic) that has been previously enabled. application programming sequence: 1. in slave mode, the application must stop writing data on the ahb, for the in endpoint to be disabled. 2. the application must set the endpoint in nak mode. see setting in endpoint nak (p. 303 ) . ? usb_diepx_ctl.snak = 1 3. wait for usb_diepx_int.inepnakeff (nak effective) interrupt. 4. set the following bits in the usb_diepx_ctl register for the endpoint that must be disabled. ? usb_diepx_ctl.epdis (endpoint disable) = 1 ? usb_diepx_ctl.snak = 1 5. assertion of usb_diepx_int.epdisbld (endpoint disabled) interrupt indicates that the core has completely disabled the specified endpoint. along with the assertion of the interrupt, the core also clears the following bits. ? usb_diepx_ctl.epena = 0 ? usb_diepx_ctl.epdis = 0 6. the application must read the usb_diepx_tsiz register for the periodic in ep, to calculate how much data on the endpoint was transmitted on the usb. 7. the application must flush the data in the endpoint transmit fifo, by setting the following fields in the usb_grstctl register. ? usb_grstctl.txfnum = endpoint transmit fifo number ? usb_grstctl.txfflsh = 1
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 305 www.energymicro.com the application must poll the usb_grstctl register, until the txfflsh bit is cleared by the core, which indicates the end of flush operation. to transmit new data on this endpoint, the application can re-enable the endpoint at a later point. 15.4.4.2.3.5 bulk in stall these notes refer to figure 15.25 (p. 305 ) 1. the application has scheduled an in transfer on receiving the usb_diepx_int.intkntxfemp (in token received when txfifo empty) interrupt. 2. when the transfer is in progress, the application must force a stall on the endpoint. this could be because the application has received a setfeature.endpoint halt command. the application sets the stall bit, disables the endpoint and waits for the usb_diepx_int.epdisbld (endpoint disabled) interrupt. this generates stall handshakes for the endpoint on the usb. 3. on receiving the interrupt, the application flushes the non-periodic transmit fifo and clears the usb_dctl.sgnpinnak (global in np nak) bit. 4. on receiving the clearfeature.endpoint halt command, the application clears the stall bit. 5. the endpoint behaves normally and the application can re-enable the endpoint for new transfers figure 15.25. bulk in stall h ost ap p lica t ion d e vice usb i n n a k intkntxfemp intr i n 512 byt es a c k do _ in _ xfer xact _ 1 dat a rdy xact _ 2 dat a rdy i n xact _ 1 of 2 xact _ 2 of 2 n ptxfemp int s t a l l 512 byt es a c k new xact epdisabled int r i n s t a l l idle ( wait _ int r ) set up _ np _ in _ pkt set _ st all ep _ disable ; flush _ nper _ t x _ fifo ; clr global in np nak wait _ for _ host / app t o clr st all clr _ st all do _ in _ xfer set up _ np _ in _ pkt 1 2 3 4 5 xfersize = 1025 byt es pkt cnt = 3 epena = 1 i n n a k i n intkntxfemp intr 15.4.4.2.3.6 incomplete isochronous in data transfers this section describes what the application must do on an incomplete isochronous in data transfer. internal data flow 1. an isochronous in transfer is treated as incomplete in one of the following conditions.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 306 www.energymicro.com a. the core receives a corrupted isochronous in token on at least one isochronous in endpoint. in this case, the application detects a usb_gintsts.incompisoin (incomplete isochronous in transfer) interrupt. b. the application or dma is slow to write the complete data payload to the transmit fifo and an in token is received before the complete data payload is written to the fifo. in this case, the application detects a usb_diepx_int.intkntxfemp (in token received when txfifo empty) interrupt. the application can ignore this interrupt, as it eventually results in a usb_gintsts.incompisoin (incomplete isochronous in transfer) interrupt at the end of periodic frame. i. the core transmits a zero-length data packet on the usb in response to the received in token. 2. in either of the aforementioned cases, in slave mode, the application must stop writing the data payload to the transmit fifo as soon as possible. 3. the application must set the nak bit and the disable bit for the endpoint. in dma mode, the core automatically stops fetching the data payload when the endpoint disable bit is set. 4. the core disables the endpoint, clears the disable bit, and asserts the endpoint disable interrupt for the endpoint. application programming sequence 1. the application can ignore the usb_diepx_int.intkntxfemp (in token received when txfifo empty) interrupt on any isochronous in endpoint, as it eventually results in a usb_gintsts.incompisoin (incomplete isochronous in transfer) interrupt. 2. assertion of the usb_gintsts.incompisoin (incomplete isochronous in transfer) interrupt indicates an incomplete isochronous in transfer on at least one of the isochronous in endpoints. 3. the application must read the endpoint control register for all isochronous in endpoints to detect endpoints with incomplete in data transfers. 4. in slave mode, the application must stop writing data to the periodic transmit fifos associated with these endpoints on the ahb. 5. in both modes of operation, program the following fields in the usb_diepx_ctl register to disable the endpoint. ? usb_diepx_ctl.snak = 1 ? usb_diepx_ctl.epdis (endpoint disable) = 1 6. the usb_diepx_int.epdisbld (endpoint disabled) interrupt?s assertion indicates that the core has disabled the endpoint. ? at this point, the application must flush the data in the associated transmit fifo or overwrite the existing data in the fifo by enabling the endpoint for a new transfer in the next frame. to flush the data, the application must use the usb_grstctl register. 15.4.4.2.3.7 stalling non-isochronous in endpoints this section describes how the application can stall a non-isochronous endpoint. application programming sequence 1. disable the in endpoint to be stalled. set the stall bit as well. 2. usb_diepx_ctl.epdis (endpoint disable) = 1, when the endpoint is already enabled ? usb_diepx_ctl.stall = 1 ? the stall bit always takes precedence over the nak bit 3. assertion of the usb_diepx_int.epdisbld (endpoint disabled) interrupt indicates to the application that the core has disabled the specified endpoint. 4. the application must flush the non-periodic or periodic transmit fifo, depending on the endpoint type. in case of a non-periodic endpoint, the application must re-enable the other non-periodic endpoints, which do not need to be stalled, to transmit data. 5. whenever the application is ready to end the stall handshake for the endpoint, the usb_diepx_ctl.stall bit must be cleared.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 307 www.energymicro.com 6. if the application sets or clears a stall for an endpoint due to a setfeature.endpoint halt command or clearfeature.endpoint halt command, the stall bit must be set or cleared before the application sets up the status stage transfer on the control endpoint. special case: stalling the control in/out endpoint the core must stall in/out tokens if, during the data stage of a control transfer, the host sends more in/out tokens than are specified in the setup packet. in this case, the application must to enable usb_diepx_int.intkntxfemp and usb_doepx_int.outtknepdis interrupts during the data stage of the control transfer, after the core has transferred the amount of data specified in the setup packet. then, when the application receives this interrupt, it must set the stall bit in the corresponding endpoint control register, and clear this interrupt. 15.4.4.2.3.8 worst-case response time when the acts as a device, there is a worst case response time for any tokens that follow an isochronous out. this worst case response time depends on the ahb clock frequency. the core registers are in the ahb domain, and the core does not accept another token before updating these register values. the worst case is for any token following an isochronous out, because for an isochronous transaction, there is no handshake and the next token could come sooner. this worst case value is 7 phy clocks in fs mode. if this worst case condition occurs, the core responds to bulk/interrupt tokens with a nak and drops isochronous and setup tokens. the host interprets this as a timeout condition for setup and retries the setup packet. for isochronous transfers, the incompisoin and incomplp interrupts inform the application that isochronous in/out packets were dropped. 15.4.4.2.3.9 choosing the value of usb_gusbcfg.usbtrdtim the value in usb_gusbcfg.usbtrdtim is the time it takes for the mac, in terms of phy clocks after it has received an in token, to get the fifo status, and thus the first data from pfc (packet fifo controller) block. this time involves the synchronization delay between the phy and ahb clocks. this delay is 5 clocks. once the mac receives an in token, this information (token received) is synchronized to the ahb clock by the pfc (the pfc runs on the ahb clock). the pfc then reads the data from the spram and writes it into the dual clock source buffer. the mac then reads the data out of the source buffer (4 deep). if the ahb is running at a higher frequency than the phy (in low-speed mode), the application can use a smaller value for usb_gusbcfg.usbtrdtim. figure 15.26 (p. 308 ) explains the 5-clock delay. this diagram has the following signals: ? tkn_rcvd: token received information from mac to pfc ? dynced_tkn_rcvd: doubled sync tkn_rcvd, from pclk to hclk domain ? spr_read: read to spram ? spr_addr: address to spram ? spr_rdata: read data from spram ? srcbuf_push: push to the source buffer ? srcbuf_rdata: read data from the source buffer. data seen by mac the application can use the following formula to calculate the value of usb_gusbcfg.usbtrdtim: 4 * ahb clock + 1 phy clock = (2 clock sync + 1 clock memory address + 1 clock memory data from sync ram) + (1 phy clock (next phy clock mac can sample the 2-clock fifo output)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 308 www.energymicro.com figure 15.26. usbtrdtim max timing case error wrong image h ost ap p lica t ion d e vice usb i n n a k intkntxfemp intr i n 512 byt es a c k do _ in _ xfer xact _ 1 dat a rdy xact _ 2 dat a rdy i n xact _ 1 of 2 xact _ 2 of 2 n ptxfemp int s t a l l 512 byt es a c k new xact epdisabled int r i n s t a l l idle ( wait _ int r ) set up _ np _ in _ pkt set _ st all ep _ disable ; flush _ nper _ t x _ fifo ; clr global in np nak wait _ for _ host / app t o clr st all clr _ st all do _ in _ xfer set up _ np _ in _ pkt 1 2 3 4 5 xfersize = 1025 byt es pkt cnt = 3 epena = 1 i n n a k i n intkntxfemp intr 15.4.4.2.3.10 handling babble conditions if receives a packet that is larger than the maximum packet size for that endpoint, the core stops writing data to the rx buffer and waits for the end of packet (eop). when the core detects the eop, it flushes the packet in the rx buffer and does not send any response to the host. if the core continues to receive data at the eof2 (the end of frame 2, which is very close to sof), the core generates an early_suspend interrupt (usb_gintsts.erlysusp). on receiving this interrupt, the application must check the erratic_error status bit (usb_dsts.errticerr). if this bit is set, the application must take it as a long babble and perform a soft reset. 15.4.4.2.3.11 generic non-periodic (bulk and control) in data transfers in dma and slave mode to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the host, it must initialize an endpoint as described in endpoint initialization (p. 281 ) . for packet writes in slave mode, see: packet write in slave mode (p. 303 ) . application requirements 1. before setting up an in transfer, the application must ensure that all data to be transmitted as part of the in transfer is part of a single buffer, and must program the size of that buffer and its start address (in dma mode) to the endpoint-specific registers. 2. for in transfers, the transfer size field in the endpoint transfer size register denotes a payload that constitutes multiple maximum-packet-size packets and a single short packet. this short packet is transmitted at the end of the transfer.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 309 www.energymicro.com ? to transmit a few maximum-packet-size packets and a short packet at the end of the transfer: ? transfer size[epnum] = n * mps[epnum] + sp (where n is an integer >= 0, and 0 <= sp < mps[epnum]) ? if (sp > 0), then packet count[epnum] = n + 1. otherwise, packet count[epnum] = n a. to transmit a single zero-length data packet: ? transfer size[epnum] = 0 ? packet count[epnum] = 1 b. to transmit a few maximum-packet-size packets and a zero-length data packet at the end of the transfer, the application must split the transfer in two parts. the first sends maximum-packet-size data packets and the second sends the zero-length data packet alone. c. first transfer: transfer size[epnum] = n * mps[epnum]; packet count = n; d. second transfer: transfer size[epnum] = 0; packet count = 1; 3. in dma mode, the core fetches an in data packet from the memory, always starting at a dword boundary. if the maximum packet size of the in endpoint is not a multiple of 4, the application must arrange the data in the memory with pads inserted at the end of a maximum-packet-size packet so that a new packet always starts on a dword boundary. 4. once an endpoint is enabled for data transfers, the core updates the transfer size register. at the end of in transfer, which ended with a endpoint disabled interrupt, the application must read the transfer size register to determine how much data posted in the transmit fifo was already sent on the usb. 5. data fetched into transmit fifo = application-programmed initial transfer size ? core-updated final transfer size ? data transmitted on usb = (application-programmed initial packet count ? core updated final packet count) * mps[epnum] ? data yet to be transmitted on usb = (application-programmed initial transfer size ? data transmitted on usb) internal data flow 1. the application must set the transfer size and packet count fields in the endpoint-specific registers and enable the endpoint to transmit the data. 2. in slave mode, the application must also write the required data to the transmit fifo for the endpoint. in dma mode, the core fetches the data from memory according to the application setting for the endpoint. 3. every time a packet is written into the transmit fifo, either by the core?s internal dma (in dma mode) or the application (in slave mode), the transfer size for that endpoint is decremented by the packet size. the data is fetched from the memory (dma/application), until the transfer size for the endpoint becomes 0. after writing the data into the fifo, the ?number of packets in fifo? count is incremented (this is a 3-bit count, internally maintained by the core for each in endpoint transmit fifo. the maximum number of packets maintained by the core at any time in an in endpoint fifo is eight). for zero-length packets, a separate flag is set for each fifo, without any data in the fifo. 4. once the data is written to the transmit fifo, the core reads it out upon receiving an in token. for every non-isochronous in data packet transmitted with an ack handshake, the packet count for the endpoint is decremented by one, until the packet count is zero. the packet count is not decremented on a timeout. 5. for zero length packets (indicated by an internal zero length flag), the core sends out a zero-length packet for the in token and decrements the packet count field. 6. if there is no data in the fifo for a received in token and the packet count field for that endpoint is zero, the core generates a in tkn rcvd when fifo empty interrupt for the endpoint, provided the endpoint nak bit is not set. the core responds with a nak handshake for non-isochronous endpoints on the usb. 7. for control in endpoint, if there is a timeout condition, the usb_diepx_int.timeout interrupt is generated. 8. when the transfer size is 0 and the packet count is 0, the transfer complete interrupt for the endpoint is generated and the endpoint enable is cleared.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 310 www.energymicro.com application programming sequence 1. program the usb_diepx_tsiz register with the transfer size and corresponding packet count. in dma mode, also program the usb_diepx_dmaaddr register. 2. program the usb_diepx_ctl register with the endpoint characteristics and set the cnak and endpoint enable bits. 3. in slave mode when transmitting non-zero length data packet, the application must poll the usb_diepx_txfsts register (where x is the fifo number associated with that endpoint) to determine whether there is enough space in the data fifo. the application can optionally use usb_diepx_int.txfemp before writing the data. 15.4.4.2.3.12 examples slave mode bulk in transaction these notes refer to figure 15.27 (p. 310 ) . 1. the host attempts to read data (in token) from an endpoint. 2. on receiving the in token on the usb, the core returns a nak handshake, because no data is available in the transmit fifo. 3. to indicate to the application that there was no data to send, the core generates a usb_diepx_int.intkntxfemp (in token received when txfifo empty) interrupt. 4. when data is ready, the application sets up the usb_diepx_tsiz register with the transfer size and packet count fields. 5. the application writes one maximum packet size or less of data to the non-periodic txfifo. 6. the host reattempts the in token. 7. because data is now ready in the fifo, the core now responds with the data and the host acks it. 8. because the xfersize is now zero, the intended transfer is complete. the device core generates a usb_diepx_int.xfercompl interrupt. 9. the application processes the interrupt and uses the setting of the usb_diepx_int.xfercompl interrupt bit to determine that the intended transfer is complete. figure 15.27. slave mode bulk in transaction ap p lica t ion d e vice usb int kn t x fe mp intr in 512 byt es ack new xfer rdy ? xact _ 1 in tkn = 0 tim eout = 0 xfercom p = 1 1 in 3 2 nak in nak 4 5 6 7 8 9 xfer _ cnt = 512 byt es pkt cnt = 1 ep enable = 1 idle unt il int r set up _ np _ in _ pkt () wr _ reg ( ep . dieptsizn ) idle unt il int r wait for xfer yes in x fer c ompl intr h ost
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 311 www.energymicro.com slave mode bulk in transfer (pipelined transaction) these notes refer to figure 15.28 (p. 312 ) 1. the host attempts to read data (in token) from an endpoint. 2. on receiving the in token on the usb, the core returns a nak handshake, because no data is available in the transmit fifo. 3. to indicate that there was no data to send, the core generates an usb_diepx_int.intkntxfemp (in token received when txfifo empty) interrupt. 4. when data is ready, the application sets up the usb_diepx_tsiz register with the transfer size and packet count. 5. the application writes one maximum packet size or less of data to the non-periodic txfifo. 6. the host reattempts the in token. 7. because data is now ready in the fifo, the core responds with the data, and the host acks it. 8. when the txfifo level falls below the halfway mark, the core generates a usb_gintsts.nptxfemp (nonperiodic txfifo empty) interrupt. this triggers the application to start writing additional data packets to the fifo. 9. a data packet for the second transaction is ready in the txfifo. 10. a data packet for third transaction is ready in the txfifo while the data for the second packet is being sent on the bus. 11. the second data packet is sent to the host. 12. the last short packet is sent to the host. 13. because the last packet is sent and xfersize is now zero, the intended transfer is complete. the core generates a usb_diepx_int.xfercompl interrupt. 14. the application processes the interrupt and uses the setting of the usb_diepx_int.xfercompl interrupt bit to determine that the intended transfer is complete
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 312 www.energymicro.com figure 15.28. slave mode bulk in transfer (pipelined transaction) xact _ 2 h ost ap p lica t ion d e vice usb i n a c k a c k i n 1 byt e a c k xact _ 1 of 3 xact _ 2 of 3 xact _ 3 of 3 wr _ reg ( xfer _ size _ reg ) n a k i n i n 512 byt es 512 byt es 1 2 3 4 6 7 8 9 1 0 2 1 1 1 2 1 3 1 4 idle unt il int r set up _ np _ in _ pkt set up _ np _ in _ pkt set up _ np _ in _ pkt in token = 0 tim eout = 0 ack = 0 xfercom pl = 1 xact _ 2 xact _ 3 xact _ 1 xfer _ cnt = 1025 byt es pkt _ cnt = 3 ep enable = 1 idle unt il int r 5 n p t x f e m p i n t r i n t kn t x fe mp intr xfercompl intr slave mode bulk in two-endpoint transfer these notes refer to figure 15.29 (p. 313 ) 1. the host attempts to read data (in token) from endpoint 1. 2. on receiving the in token on the usb, the core returns a nak handshake, because no data is available in the transmit fifo for endpoint 1, and generates a usb_diep1_int.intkntxfemp (in token received when txfifo empty) interrupt. 3. the application processes the interrupt and initializes usb_diep1_tsiz register with the transfer size and packet count fields. the application starts writing the transaction data to the transmit fifo. 4. the application writes one maximum packet size or less of data for endpoint 1 to the non-periodic txfifo. 5. meanwhile, the host attempts to read data (in token) from endpoint 2. 6. on receiving the in token on the usb, the core returns a nak handshake, because no data is available in the transmit fifo for endpoint 2, and the core generates a usb_diep2_int.intkntxfemp (in token received when txfifo empty) interrupt. 7. because the application has completed writing the packet for endpoint 1, it initializes the usb_diep2_tsiz register with the transfer size and packet count fields. the application starts writing the transaction data into the transmit fifo for endpoint 2. 8. the host repeats its attempt to read data (in token) from endpoint 1. 9. because data is now ready in the txfifo, the core returns the data, which the host acks. 10. meanwhile, the application has initialized the data for the next two packets in the txfifo (ep2.xact1 and ep1.xact2, in order). 11. the host repeats its attempt to read data (in token) from endpoint 2. 12. because endpoint 2?s data is ready, the core responds with the data (ep2.xact_1), which the host acks.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 313 www.energymicro.com 13. meanwhile, the application has initialized the data for the next two packets in the txfifo (ep2.xact2 and ep1.xact3, in order). the application has finished initializing data for the two endpoints involved in this scenario. 14. the host repeats its attempt to read data (in token) from endpoint 1. 15. because data is now ready in the fifo, the core responds with the data, which the host acks. 16. the host repeats its attempt to read data (in token) from endpoint 2. 17. with data now ready in the fifo, the core responds with the data, which the host acks. 18. with the last packet for endpoint 2 sent and its xfersize now zero, the intended transfer is complete. the core generates a usb_diep2_int.xfercompl interrupt for this endpoint. 19. the application processes the interrupt and uses the setting of the usb_diep2_int.xfercompl interrupt bit to determine that the intended transfer on endpoint 2 is complete. 20. the host repeats its attempt to read data (in token) from endpoint 1 (last transaction). 21. with data now ready in the fifo, the core responds with the data, which the host acks. 22. because the last endpoint one packet has been sent and xfersize is now zero, the intended transfer is complete. the core generates a usb_diep1_int.xfercompl interrupt for this endpoint. 23. the application processes the interrupt and uses the setting of the usb_diep1_int.xfercompl interrupt bit to determine that the intended transfer on endpoint 1 is complete. figure 15.29. slave mode bulk in two-endpoint transfer 10 bytes ep 2 drvr host application device usb in , ep 1 nak . in , ep 1 512 bytes 512 bytes ack ep 1 . xact _ 1 ep 2 . xact _ 1 ep 1 . xact _ 2 ep 2 . xact _ 2 ep 1 . xact _ 2 wr _ reg ( ep 1 . usb_ di epx_tsiz ) wr _ reg ( ep 2 . usb_ di epx_tsiz ) ep 1 . xact _ 3 ep 1 . xact _ 2 in , ep 2 ep 2 . intkntxfemp intr nak in , ep 2 512 bytes 1 byte ep 1 . setup _ np _ in _ pkt ep 1 . setup _ np _ in _ pkt ep 1 . setup _ np _ in _ pkt 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 xfer _ complete = 1 ep _ num 1 register set xfersize = 1025 bytes pktcnt = 3 epena = 1 ep _ num 2 registers xfersize = 522 bytes pktcnt = 2 epena = 1 xfer _ complete = 1 idle until intr idle until intr ep 2 . setup _ np _ in _ pkt ep 2 . setup _ np _ in _ pkt idle until intr idle until intr ep 1 . xfer comp intr ack in , ep 1 in , ep 2 ack in , ep 1 ack ep 1 . intkn txf emp intr ep 2 . xfercompl intr 15.4.4.2.3.13 generic periodic in (interrupt and isochronous) data transfers to initialize the core after power-on reset, the application must follow the sequence in overview: programming the core (p. 246 ) . before it can communicate with the host, it must initialize an endpoint
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 314 www.energymicro.com as described in endpoint initialization (p. 281 ) . for packet writes in slave mode, see: packet write in slave mode (p. 303 ) . application requirements 1. application requirements 1, 2, 3, and 4 of generic non-periodic (bulk and control) in data transfers without thresholding in dma and slave mode (p. 308 ) also apply to periodic in data transfers, except for a slight modification of requirement 2. ? the application can only transmit multiples of maximum-packet-size data packets or multiples of maximum-packet-size packets, plus a short packet at the end. to transmit a few maximum-packet- size packets and a short packet at the end of the transfer, the following conditions must be met. ? transfer size[epnum] = n * mps[epnum] + sp(where n is an integer # 0, and 0 >= sp < mps[epnum]) ? if (sp > 0), packet count[epnum] = n + 1otherwise, packet count[epnum] = n; ? mc[epnum] = packet count[epnum] ? the application cannot transmit a zero-length data packet at the end of transfer. it can transmit a single zero-length data packet by it self. to transmit a single zero-length data packet, ? transfer size[epnum] = 0 ? packet count[epnum] = 1 ? mc[epnum] = packet count[epnum] 2. the application can only schedule data transfers 1 frame at a time. ? (usb_diepx_tsiz.mc ? 1) * usb_diepx_ctl.mps =< usb_diepx_tsiz.xfersize =< usb_diepx_tsiz.mc * usb_diepx_ctl.mps ? usb_diepx_tsiz.pktcnt = usb_diepx_tsiz.mc ? if usb_diepx_tsiz.xfersize < usb_diepx_tsiz.mc * usb_diepx_ctl.mps, the last data packet of the transfer is a short packet. 3. this step is not applicable for isochronous data transfers, only for interrupt transfers. the application can schedule data transfers for multiple frames, only if multiples of max packet sizes (up to 3 packets), must be transmitted every frame. this is can be done, only when the core is operating in dma mode. this is not a recommended mode though. ? ((n*usb_diepx_tsiz.mc) - 1)*usb_diepx_ctl.mps <= usb_diepx_tsiz.xfersize <= n*usb_diepx_tsiz.mc*usb_diepx_ctl.mps ? usb_diepx_tsiz.pktcnt = n*usb_diepx_tsiz.mc ? n is the number of frames for which the data transfers are scheduled data transmitted per frame in this case would be usb_diepx_tsiz.mc*usb_diepx_ctl.mps, in all the frames except the last one. in the frame ?n?, the data transmitted would be (usb_diepx_tsiz.xfersize - (n-1)*usb_diepx_tsiz.mc*usb_diepx_ctl.mps) 4. for periodic in endpoints, the data must always be prefetched 1 frame ahead for transmission in the next frame. this can be done, by enabling the periodic in endpoint 1 frame ahead of the frame in which the data transfer is scheduled. 5. the complete data to be transmitted in the frame must be written into the transmit fifo (either by the application or the dma), before the periodic in token is received. even when 1 dword of the data to be transmitted per frame is missing in the transmit fifo when the periodic in token is received, the core behaves as when the fifo was empty. when the transmit fifo is empty, 6. a zero data length packet would be transmitted on the usb for iso in endpoints ? a nak handshake would be transmitted on the usb for intr in endpoints 7. for a high bandwidth in endpoint with three packets in a frame, the application can program the endpoint fifo size to be 2*max_pkt_size and have the third packet load in after the first packet has been transmitted on the usb. internal data flow 1. the application must set the transfer size and packet count fields in the endpoint-specific registers and enable the endpoint to transmit the data.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 315 www.energymicro.com 2. in slave mode, the application must also write the required data to the associated transmit fifo for the endpoint. in dma mode, the core fetches the data for the endpoint from memory, according to the application setting. 3. every time either the core?s internal dma (in dma mode) or the application (in slave mode) writes a packet to the transmit fifo, the transfer size for that endpoint is decremented by the packet size. the data is fetched from dma or application memory until the transfer size for the endpoint becomes 0. 4. when an in token is received for an periodic endpoint, the core transmits the data in the fifo, if available. if the complete data payload (complete packet) for the frame is not present in the fifo, then the core generates an in token received when txfifo empty interrupt for the endpoint. ? a zero-length data packet is transmitted on the usb for isochronous in endpoints ? a nak handshake is transmitted on the usb for interrupt in endpoints 5. the packet count for the endpoint is decremented by 1 under the following conditions: ? for isochronous endpoints, when a zero- or non-zero-length data packet is transmitted ? for interrupt endpoints, when an ack handshake is transmitted ? when the transfer size and packet count are both 0, the transfer completed interrupt for the endpoint is generated and the endpoint enable is cleared. 6. at the ?periodic frame interval? (controlled by usb_dcfg.perfrint), when the core finds non- empty any of the isochronous in endpoint fifos scheduled for the current frame non-empty, the core generates a usb_gintsts.incompisoin interrupt. application programming sequence (transfer per frame) 1. program the usb_diepx_tsiz register. in dma mode, also program the usb_diepx_dmaaddr register. 2. program the usb_diepx_ctl register with the endpoint characteristics and set the cnak and endpoint enable bits. 3. in slave mode, write the data to be transmitted in the next frame to the transmit fifo. 4. asserting the usb_diepx_int.intkntxfemp (in token received when txfifo empty) interrupt indicates that either the dma or application has not yet written all data to be transmitted to the transmit fifo. 5. if the interrupt endpoint is already enabled when this interrupt is detected, ignore the interrupt. if it is not enabled, enable the endpoint so that the data can be transmitted on the next in token attempt. ? if the isochronous endpoint is already enabled when this interrupt is detected, see incomplete isochronous in data transfers (p. 305 ) for more details. 6. the core handles timeouts internally on interrupt in endpoints programmed as periodic endpoints without application intervention. the application, thus, never detects a usb_diepx_int.timeout interrupt for periodic interrupt in endpoints. 7. asserting the usb_diepx_int.xfercompl interrupt with no usb_diepx_int.intkntxfemp (in token received when txfifo empty) interrupt indicates the successful completion of an isochronous in transfer. a read to the usb_diepx_tsiz register must indicate transfer size = 0 and packet count = 0, indicating all data is transmitted on the usb. 8. asserting the usb_diepx_int.xfercompl interrupt, with or without the usb_diepx_int.intkntxfemp (in token received when txfifo empty) interrupt, indicates the successful completion of an interrupt in transfer. a read to the usb_diepx_tsiz register must indicate transfer size = 0 and packet count = 0, indicating all data is transmitted on the usb. 9. asserting the usb_gintsts.incompisoin (incomplete isochronous in transfer) interrupt with none of the aforementioned interrupts indicates the core did not receive at least 1 periodic in token in the current frame. 10. for isochronous in endpoints, see incomplete isochronous in data transfers (p. 305 ) , for more details. 15.4.4.2.3.14 generic periodic in data transfers using the periodic transfer interrupt feature this section describes a typical periodic in (isoc / intr) data transfer with the periodic transfer interrupt feature.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 316 www.energymicro.com 1. before setting up an in transfer, the application must ensure that all data to be transmitted as part of the in transfer is part of a single buffer, and must program the size of that buffer and its start address (in dma mode) to the endpoint-specific registers. 2. for in transfers, the transfer size field in the endpoint transfer size register denotes a payload that constitutes multiple maximum-packet-size packets and a single short packet. this short packet is transmitted at the end of the transfer. a. to transmit a few maximum-packet-size packets and a short packet at the end of the transfer: ? transfer size[epnum] = n * mps[epnum] + sp (where n is an integer > 0, and 0 < sp < mps[epnum]. a higher value of n reduces the periodicity of the usb_doepx_int.xfercompl interrupt) ? if (sp > 0), then packet count[epnum] = n + 1. otherwise, packet count[epnum] = n b. to transmit a single zero-length data packet: ? transfer size[epnum] = 0 ? packet count[epnum] = 1 c. to transmit a few maximum-packet-size packets and a zero-length data packet at the end of the transfer, the application must split the transfer in two parts. the first sends maximum-packet-size data packets and the second sends the zero-length data packet alone. ? first transfer: transfer size[epnum] = n * mps[epnum]; packet count = n; ? second transfer: transfer size[epnum] = 0; packet count = 1; d. the application can only transmit multiples of maximum-packet-size data packets or multiples of maximum-packet-size packets, plus a short packet at the end. to transmit a few maximum-packet- size packets and a short packet at the end of the transfer, the following conditions must be met. ? transfer size[epnum] = n * mps[epnum] + sp (where n is an integer > 0, and 0 < sp < mps[epnum]) ? if (sp > 0), packet count[epnum] = n + 1 otherwise, packet count[epnum] = n; ? mc[epnum] = number of packets to be sent out in a frame. e. the application cannot transmit a zero-length data packet at the end of transfer. it can transmit a single zero-length data packet by itself. to transmit a single zero-length data packet, ? transfer size[epnum] = 0 ? packet count[epnum] = 1 ? mc[epnum] = packet count[epnum] 3. in dma mode, the core fetches an in data packet from the memory, always starting at a dword boundary. if the maximum packet size of the in endpoint is not a multiple of 4, the application must arrange the data in the memory with pads inserted at the end of a maximum-packet-size packet so that a new packet always starts on a dword boundary. 4. once an endpoint is enabled for data transfers, the core updates the transfer size register. at the end of in transfer, which ended with a endpoint disabled interrupt, the application must read the transfer size register to determine how much data posted in the transmit fifo was already sent on the usb. ? data fetched into transmit fifo = application-programmed initial transfer size - core-updated final transfer size ? data transmitted on usb = (application-programmed initial packet count - core updated final packet count) * mps[epnum] ? data yet to be transmitted on usb = (application-programmed initial transfer size - data transmitted on usb) 5. the application can schedule data transfers for multiple frames, only if multiples of max packet sizes (up to 3 packets), must be transmitted every frame. this is can be done, only when the core is operating in dma mode. ? ((n*usb_diepx_tsiz.mc) - 1)*usb_diepx_ctl.mps <= usb_diepx_tsiz.xfersize <= n*usb_diepx_tsiz.mc*usb_diepx_ctl.mps ? usb_diepx_tsiz.pktcnt = n*usb_diepx_tsiz.mc ? n is the number of frames for which the data transfers are scheduled. data transmitted per frame in this case is usb_diepx_tsiz.mc*usb_diepx_ctl.mps in all frames except the last one. in frame n, the data transmitted is (usb_diepx_tsiz.xfersize ? (n ? 1) * usb_diepx_tsiz.mc * usb_diepx_ctl.mps)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 317 www.energymicro.com 6. for periodic in endpoints, the data must always be prefetched 1 frame ahead for transmission in the next frame. this can be done, by enabling the periodic in endpoint 1 frame ahead of the frame in which the data transfer is scheduled. 7. the complete data to be transmitted in the frame must be written into the transmit fifo, before the periodic in token is received. even when 1 dword of the data to be transmitted per frame is missing in the transmit fifo when the periodic in token is received, the core behaves as when the fifo was empty. when the transmit fifo is empty, ? a zero data length packet would be transmitted on the usb for isoc in endpoints ? a nak handshake would be transmitted on the usb for intr in endpoints ? usb_diepx_tsiz.pktcnt is not decremented in this case. 8. for a high bandwidth in endpoint with three packets in a frame, the application can program the endpoint fifo size to be 2 * max_pkt_size and have the third packet load in after the first packet has been transmitted on the usb. figure 15.30. periodic in application flow for periodic transfer interrupt feature n ote re q u ir e m e n t s for x f e r size a n d pk t cn t p r og r a m m in g 1 . pa ck e t size h a s t o b e of m a xpk t size f or a ll ( m icr o ) f r a m e s e xce p t f or la st p a ck e t w h ich ca n b e a sh or t pa ck e t . 2 . sh or t pa ck e t s a r e n ot a llow e d in b e t w e e n x f e r s 5 . cor e w ill r e a d p a ck e t s f r om syst e m m e m or y on ly f r om d w ord a lig n e d a d d r e sse s . 6 . if m a xpk t size is n ot d w ord a lig n e d , ap p lica t ion m u st in se r t p a d s a t t h e e n d of t h e p a ck e t so t h a t n e w p a ck e t is a lw a ys d w ord a lig n e d . 7 . th r e sh old in g in n ot su p p or t e d f or t h e pe r iod ic tr a n sf e r in t e r r u p t e n h a n ce m e n t start de - a llo c a t e da t a ra m me m o ry program ep ct rl regist er t o st art t he xfer usb_ diep x_ ctl .cnak = 0b1 usb_ diep x_ ctl .txfnum = t x _ fifo _ num ; usb_ diep x_ ctl .epena = 0b 1 usb_ diep x_ ctl .snak = 0 b 0 usb_ diep x_ ctl .epdis = 0 b 0 wait for usb _ doep x _ int xfercompl int errupt & report error if t im eout expires if usb _ diep x _ tsiz xfersize ! = 0 or usb_ diep x_ tsiz pktcnt ! = 0 ret urn check for error _ scenario if no error _ scenario set report error yes no int ialize variables alloca t e a b u f f e r in t h e syst e m m e m or y f or m u lt ip le x f e r s . bu f f e r size sh ou ld b e m u lt ip le ot m a xpk t size . program t he dma address diepdma = start ad d r e ss of t h e d a t a m e m or y program xfer _ size regist er usb_ diep x_ tsiz xfersize = x f e r size sp a n n in g a cr oss m u lt ip le x f e r s usb_ diep x_ tsiz pktcnt = pr og r a m pk t cn t f or m u lt ip le x f e r s usb_ diep x_ tsiz .mc = m a x n u m b e r of pa ck e t s in a ( m icr o ) f r a m e program t he global int sts usb_ gintmsk . incomplsocinmsk = 0b0 // m a sk in com p isocin in t e r r u p t internal data flow 1. the application must set the transfer size and packet count fields in the endpoint-specific registers and enable the endpoint to transmit the data. ? the application must enable the usb_dctl.ignrfrmnum 2. when an isochronous out endpoint is enabled by setting the endpoint enable and clearing the nak bits, the even/odd frame will be ignored by the core. ? subsequently the core updates the even / odd bit on its own
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 318 www.energymicro.com 3. every time either the core?s internal dma writes a packet to the transmit fifo, the transfer size for that endpoint is decremented by the packet size. the data is fetched from dma or application memory until the transfer size for the endpoint becomes 0. 4. when an in token is received for a periodic endpoint, the core transmits the data in the fifo, if available. if the complete data payload (complete packet) for the frame is not present in the fifo, then the core generates an in token received when txfifo empty interrupt for the endpoint. ? a zero-length data packet is transmitted on the usb for isochronous in endpoints ? a nak handshake is transmitted on the usb for interrupt in endpoints 5. if an in token comes for an endpoint on the bus, and if the corresponding txfifo for that endpoint has at least 1 packet available, and if the usb_diepx_ctl.nak bit is not set, and if the internally maintained even/odd bit match with the bit 0 of the current frame number, then the core will send this data out on the usb. the core will also decrement the packet count. core also toggles the multcount in usb_diepx_ctl register and based on the value of multcount the next pid value is sent. ? if the in token results in a timeout (core did not receive the handshake or handshake error), core rewind the fifo pointers. core does not decrement packet count. it does not toggle pid. usb_diepx_int.timeout interrupt will be set which the application could check. ? at the end of periodic frame interval (based on the value programmed in the usb_dcfg.perfrint register, core will internally set the even/odd internal bit to match the next frame. 6. the packet count for the endpoint is decremented by 1 under the following conditions: ? for isochronous endpoints, when a zero- or non-zero-length data packet is transmitted ? for interrupt endpoints, when an ack handshake is transmitted 7. the data pid of the transmitted data packet is based on the value of usb_diepx_tsiz.mc programmed by the application. in case the usb_diepx_tsiz.mc value is set to 3 then, for a particular frame the core expects to receive 3 isochronous in token for the respective endpoint. the data pids transmitted will be d2 followed by d1 and d0 respectively for the tokens. ? if any of the tokens responded with a zero-length packet due to non-availability of data in the txfifo, the packet is sent in the next frame with the pending data pid. for example, in a frame, the first received token is responded to with data and data pid value d2. if the second token is responded to with a zero-length packet, the host is expected not to send any more tokens for the respective endpoint in the current frame. when a token arrives in the next frame it will be responded to with the pending data pid value of d1. ? similarly the second token of the current frame gets responded with d0 pid. the host is expected to send only two tokens for this frame as the first token got responded with d1 pid. 8. when the transfer size and packet count are both 0, the transfer completed interrupt for the endpoint is generated and the endpoint enable is cleared. 9. the usb_gintsts.incompisoin will be masked by the application hence at the periodic frame interval (controlled by usb_dcfg.perfrint), even though the core finds non-empty any of the isochronous in endpoint fifos, usb_gintsts.incompisoin interrupt will not be generated.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 319 www.energymicro.com figure 15.31. periodic in core internal flow for periodic transfer interrupt feature if ( usb _ diepx _ ctl . cnak = 0 b 1 ) & & ( usb _ diepxctl . epena = 0 b 1 ) & & ( usb _ dctl . ignrfrmnum = 0 b 1 ) n ote 1 . cor e w ill f e t ch d a t a on ly f r om d w ord alig n e d a d d r e sse s 2 . cor e w ill n ot t a g pe r iod ic in pa ck e t s t o a sp e cif ic ( m icr o ) f r a m e n u m b e r 3 . in ca se cor e is n ot a b le t o se n d ou t d a t a f or t h e cu r r e n t ( m icr o ) f r a m e t h e d a t a w ill n ot b e f lu sh e d a n d w ill b e se n t ou t in t h e n e xt ( m icr o ) f r a m e 4 . th e d ata pid of t h e p a ck e t w h ich w a s n ot se n t in t h e p r e viou s ( m icr o ) f r a m e w ill r e m a in t h e sa m e 5 . sh or t pa ck e t s a r e n ot a llow e d in b e t w e e n t r a n sf e r s . on ly t h e la st p a ck e t ca n h a ve a sh or t pa ck e t start in tok e n fr om h ost ch e ck d a t a ava ila b le yes wait yes no isoc in transm it zero lengt h packet ( zlp ) int errupt in xm it nak packet mult cnt = mult cnt pkt cnt = pkt cnt xfersize = xfersize // m u lt cn t , pk t cn t a n d x f e r size va lu e s w ill n ot ch a n g e transm it dat a packet mult cnt = mult cnt - 1 pkt cnt = pkt cnt - 1 xfersize = xfersize - maxpkt size if m u lt cn t = 0 if pk t cn t = = 0 & & x f e r size = = 0 mult cnt = usb_ diep x_ tsiz .mc usb_diepx_int.xfercompl = 1 yes no ret urn 15.4.5 otg revision 1.3 programming model this section describes the otg programming model when the core is configured to support otg revision 1.3 of the specification. the core is an otg device supporting hnp and srp. when the core is connected to an ?a? plug, it is referred to as an a-device. when the core is connected to a ?b? plug it is referred to as a b-device. in host mode, the core turns off vbus to conserve power. srp is a method by which the b-device signals the a-device to turn on vbus power. a device must perform both data-line pulsing and vbus pulsing, but a host can detect either data-line pulsing or vbus pulsing for srp. hnp is a method by which the b-device negotiates and switches to host role. in negotiated mode after hnp, the b-device suspends the bus and reverts to the device role. 15.4.5.1 a-device session request protocol the application must set the srp-capable bit in the core usb configuration register. this enables the core to detect srp as an a-device. 1. to save power, the application suspends and turns off port power when the bus is idle by writing the port suspend and port power bits in the host port control and status register. 2. phy indicates port power off by detecting that vbus voltage level is no longer valid. 3. the device must detect se0 for at least 2 ms to start srp when vbus power is off. 4. to initiate srp, the device turns on its data line pull-up resistor for 5 to 10 ms. the core detects data-line pulsing. 5. the device drives vbus above the a-device session valid (2.0 v minimum) for vbus pulsing. the core interrupts the application on detecting srp. the session request detected bit is set in global interrupt status register (usb_gintsts.sessreqint).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 320 www.energymicro.com 6. the application must service the session request detected interrupt and turn on the port power bit by writing the port power bit in the host port control and status register. the phy indicates port power-on by detecting a valid vbus level. 7. when the usb is powered, the device connects, completing the srp process. 15.4.5.2 b-device session request protocol the application must set the srp-capable bit in the core usb configuration register. this enables the core to initiate srp as a b-device. srp is a means by which the core can request a new session from the host. 1. to save power, the host suspends and turns off port power when the bus is idle. phy indicates port power off by detecting a not valid vbus level. the core sets the early suspend bit in the core interrupt register after 3 ms of bus idleness. following this, the core sets the usb suspend bit in the core interrupt register. the phy indicates the end of the b-device session by detecting a vbus level below session valid. 2. phy to enables the vbus discharge function to speed up vbus discharge. 3. the phy indicates the session?s end by detecting a session end voltage level on vbus. this is the initial condition for srp. the core requires 2 ms of se0 before initiating srp. the application must wait until vbus discharges to 0.2 v after usb_gotgctl.bsesvld is deasserted. this discharge time can be obtained from the datasheet. 4. the application initiates srp by writing the session request bit in the otg control and status register. the core perform data-line pulsing followed by vbus pulsing. 5. the host detects srp from either the data-line or vbus pulsing, and turns on vbus. the phy indicates vbus power-on by detecting a valid vbus level. 6. the core performs vbus pulsing. the host starts a new session by turning on vbus, indicating srp success. the core interrupts the application by setting the session request success status change bit in the otg interrupt status register. the application reads the session request success bit in the otg control and status register. 7. when the usb is powered, the core connects, completing the srp process. 15.4.5.3 a-device host negotiation protocol hnp switches the usb host role from the a-device to the b-device. the application must set the hnp- capable bit in the core usb configuration register to enable the core to perform hnp as an a#device. 1. the core sends the b-device a setfeature b_hnp_enable descriptor to enable hnp support. the b-device?s ack response indicates that the b-device supports hnp. the application must set host set hnp enable bit in the otg control and status register to indicate to the core that the b-device supports hnp. 2. when it has finished using the bus, the application suspends by writing the port suspend bit in the host port control and status register. 3. when the b-device observes a usb suspend, it disconnects, indicating the initial condition for hnp. the b-device initiates hnp only when it must switch to the host role; otherwise, the bus continues to be suspended. the core sets the host negotiation detected interrupt in the otg interrupt status register, indicating the start of hnp. the phy turns off the d+ and d- pulldown resistors to indicate a device role. the phy enable the d + pull-up resistor indicates a connect for b-device.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 321 www.energymicro.com the application must read the current mode bit in the otg control and status register to determine device mode operation. 4. the b-device detects the connection, issues a usb reset, and enumerates the core for data traffic. 5. the b-device continues the host role, initiating traffic, and suspends the bus when done. the core sets the early suspend bit in the core interrupt register after 3 ms of bus idleness. following this, the core sets the usb suspend bit in the core interrupt register. 6. in negotiated mode, the core detects the suspend, disconnects, and switches back to the host role. the core turns on the d+ and d- pulldown resistors to indicate its assumption of the host role. 7. the core sets the connector id status change interrupt in the otg interrupt status register. the application must read the connector id status in the otg control and status register to determine the core?s operation as an a-device. this indicates the completion of hnp to the application. the application must read the current mode bit in the otg control and status register to determine host mode operation. 8. the b-device connects, completing the hnp process. 15.4.5.4 b-device host negotiation protocol hnp switches the usb host role from b-device to a-device. the application must set the hnp-capable bit in the core usb configuration register to enable the core to perform hnp as a b-device. 1. the a-device sends the setfeature b_hnp_enable descriptor to enable hnp support. the core?s ack response indicates that it supports hnp. the application must set the device hnp enable bit in the otg control and status register to indicate hnp support. the application sets the hnp request bit in the otg control and status register to indicate to the core to initiate hnp. 2. when it has finished using the bus, the a-device suspends by writing the port suspend bit in the host port control and status register. the core sets the early suspend bit in the core interrupt register after 3 ms of bus idleness. following this, the core sets the usb suspend bit in the core interrupt register. the core disconnects and the a-device detects se0 on the bus, indicating hnp. the core enables the d+ and d- pulldown resistors to indicate its assumption of the host role. the a-device responds by activating its d+ pull-up resistor within 3 ms of detecting se0. the core detects this as a connect. the core sets the host negotiation success status change interrupt in the otg interrupt status register, indicating the hnp status. the application must read the host negotiation success bit in the otg control and status register to determine host negotiation success. the application must read the current mode bit in the core interrupt register (usb_gintsts) to determine host mode operation. 3. the application sets the reset bit (usb_hprt.prtrst) and the core issues a usb reset and enumerates the a-device for data traffic 4. the core continues the host role of initiating traffic, and when done, suspends the bus by writing the port suspend bit in the host port control and status register. 5. in negotiated mode, when the a-device detects a suspend, it disconnects and switches back to the host role. the core disables the d+ and d- pulldown resistors to indicate the assumption of the device role. 6. the application must read the current mode bit in the core interrupt (usb_gintsts) register to determine the host mode operation. 7. the core connects, completing the hnp process.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 322 www.energymicro.com 15.4.6 otg revision 2.0 programming model otg revision 2.0 supports the new attach detection protocol (adp). this protocol enables a local device (an otg device or embedded host) to detect when a remote device is attached or detached. note adp is not supported by the core. in addition to adp, otg revision 2.0 also supports enhanced srp and hnp, which are described in the following sections: ? otg revision 2.0 session request protocol (p. 322 ) ? otg revision 2.0 host negotiation protocol (p. 324 ) note vbus pulsing is not supported in otg revision 2.0 mode. 15.4.6.1 otg revision 2.0 session request protocol when the core is behaving as an a-device, it can power off vbus when no session is active until the b-device initiates a srp. the srp detection is handled by the core. figure 15.32 (p. 323 ) illustrates the programming steps that need to be performed by a-device?s application (core as a-device) when b-device initiates a srp to establish a connection.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 323 www.energymicro.com figure 15.32. srp detection by core when operating as a-device read usb_gintsts no yes int errupt ? yes no host transact ions if host ?s applicat ion decides t o t urn on vbus volunt arily , t hen t he applicat ion need not wait for srp from device . not e : if modemis int errupt is det ect ed during t his process , it m eans t hat t he connect or has been plugged out or int erchanged . this can be confirm ed by reading host m ode (phy not driving vbus ) program usb_gintmsk. ( unm ask otgint, modemis, sessreqint ) gintsts. sessreqint = 1 ? usb_gintsts.conidstschng host init ializat ion st eps. refer t o t he host init ializat ion sect ion of t his chapt er for m ore inform at ion . ( in t his st ep t he otg fsm is in a_host st at e .) figure 15.33 (p. 324 ) illustrates the steps that need to be performed by b-device?s application (core as b-device) in order to establishing a connection with a-device by signaling a srp.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 324 www.energymicro.com figure 15.33. srp initiation by the core when acting as a b-device 1 . program usb_gintmsk ( unm ask otgint ) 2 . read usb_gotgctl no yes ( this indicat es t hat vbus is already being driven and hence t here is no need for a srp ) device init ializat ion st eps . for m ore inform at ion , see device init ializat ion sect ion of t his chapt er . int errupt ? no yes read usb _gintsts no yes read usb _gotgint usb_gotgint . sesreqsucs tschng = 1 ? no yes 1 . read usb_gotgctl 2 . clear usb_gotgint . sesreqsu cstschng by writ ing a 1 usb_gotgctl . sesreqscs = 1 ? yes device init ializat ion st eps . for m ore inform at ion , see device init ializat ion sect ion of t his chapt er . no device transact ions device (otg fsm in b _idle st at e) usb_gotgctl. bsesvld = 1 ? set usb_gotgctl. sesreq = 1 usb_gintsts. otgint = 1? note the programming flow illustrated in figure 15.33 (p. 324 ) is similar to otg revision 1.3. this is because the presence or absence of vbus pulsing is transparent to the application. 15.4.6.2 otg revision 2.0 host negotiation protocol when the core is operating as a-device, the application must execute a getstatus() operation to the b- device with a frequency of thost_req_poll to determine the state of the host request flag in the b-device. if the host request flag is set in b-device it must program the core to change its role within thost_req_susp. figure 15.34 (p. 325 ) shows the programming steps that need to be performed by a-device?s application (core as a-device) in order to change its role to device. in figure 15.34 (p. 325 ) , the a- device performs a role change, becomes a b-device and then reverts back to host (a-device) mode of operation.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 325 www.energymicro.com figure 15.34. hnp when the core is an a-device read usb _gintsts usb_gotgint. hstnegdet = 1 ? no yes read usb_gintsts.curmod program usb_hprt . prtsusp = 1 unm ask usb_gintsts. otgint int errupt ? yes no host t o device t o host program usb_gotgctl . hstsethnpen = 1 usb_gintsts. otgint = 1 ? no int errupt ? yes no yes usb_gintsts. curmod = 0 ? no rem ain as host ( the host ? s applicat ion can t ake a call whet her t o swit ch off vbus or not ) yes end of device t ransact ions read usb _gintsts 1 . unm ask usb_gintsts.erlysusp 2 . device init ializat ion st eps . for m ore inform at ion device init ializat ion sect ion of t his chapt er . st art of device t ransact ions c 1 c 1 int errupt ? no no yes read usb _gintsts int errupt ? no no yes a - d e v i c e a s u s b h o s t read usb _gintsts int errupt wit hin 200 m s yes no yes no a - d e v i c e a s u s b d e v i c e read usb_gintsts check t hat curmod = 0 host mode transact ions yes applicat ion st art s 200 m s t im er host init ializat ion st eps . for m ore inform at ion , see host init ializat ion sect ion of t his chapt er . usb_gintsts. erlysusp = 1 ? usb_gintsts. usbsusp = 1 ? usb_gintsts.wkupint = 1 or usb _gintsts.resetdet ? host m ode ( send set feat ure com m and t o enable b _hnp_enable feat ure in hnp capable devices . hnp polling m echanism is also involved . this is done when otg fsm is in a _host st at e) , see ? figure 15.35 (p. 326 ) shows the programming steps that need to be performed by b-device?s application (core as b-device) in order to change its role to host. in figure 15.35 (p. 326 ) , the b- device performs a role change, becomes a host and then reverts back to device mode of operation.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 326 www.energymicro.com figure 15.35. hnp when the core is a b-device 1 . program 2 . program read usb _gintsts int errupt ? no no yes read usb _gintsts int errupt ? no no yes read usb _gintsts int errupt ? yes no no yes c 1 c 1 read usb _gotgint yes no read usb _gotgctl yes no rem ain as device st art of host t ransact ions end of host t ransact ions does b - device want t o rem ain host ? yes 6 . 1 . 1 host init ializat ion no read usb _gintsts int errupt ? no no yes device mode transact ions the applicat ion should ensure t hat t his process happens wit hin 200 m s read usb_gintsts.curmod and ensure it is 0 . device init ializat ion st eps . for m ore inform at ion , see device init ializat ion sect ion in t his chapt er . usb_gotgint. hstnegsucstschng = 1 ? usb_gotgctl.devsethnpen = 1 usb_gotgctl.hnpreq = 1 usb_gintsts. erlysusp = 1? usb_gintsts. usbsusp = 1? usb_gintsts. otgint = 1? clear usb_gotgint. hstnegsucstschng usb_gotgctl. hstnegsucs = 1 ? read usb_gintsts. check t hat curmod = 1. host init ializat ion st eps ( usb_hprt.prtpwr should not be program m ed ). for m ore inform at ion , see host init ializat ion sect ion in t his chapt er . set usb_hprt.prtsusp = 1. unm ask gintsts .otgint. (usb_hprt.prtpwr should not be program m ed ) program usb _hprt.prtres = 1 for a predefined t im e . usb_gintsts. disconnint = 1 ? device m ode ( receive set feat ure com m and and otg fsm is in b _peripheral st at e) note during hnp process where the b-device is going to assume the role of a host, the b-device application needs to ensure that a usb reset process is programmed (in usb_hprt
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 327 www.energymicro.com register) within 150 ms (tb_acon_bse0) of getting a usb_hprt.prtconndet interrupt. 15.4.7 fifo ram allocation 15.4.7.1 data fifo ram allocation external ram must be allocated among different fifos in the core before any transactions can start. the application must follow this procedure every time it changes core fifo ram allocation. the application must allocate data ram per fifo based on the ahb?s operating frequency, the phy clock frequency, the available ahb bandwidth, and the performance required on the usb. based on the above mentioned criteria, the application must provide a table as described below with ram sizes for each fifo in each mode. the core shares a single fifo ram between transmit fifo(s) and receive fifo. in dma mode?the fifo ram is also used for storing the some register information. the device mode endpoint dma address registers (usb_diep0dmaaddr, usb_doep0dmaaddr, usb_diepx_dmaaddr, usb_doepx_dmaaddr) and host mode channel dma registers (usb_hcx_dmaaddr) are stored in the fifo ram. ? these register information are stored at the end of the fifo ram after the space allocated for receive and transmit fifo. these register space must also be taken into account when calculating the total fifo depth of the core as explained in the following sections. the registers usb_diepx_dmaaddr/usb_doepx_dmaaddr are maintained in ram. the following rules apply while calculating how much ram space must be allocated to store these registers. host mode: ? slave mode only: no space needed. ? dma mode: one location per channel. device mode: ? slave mode only: no space needed. ? dma mode: one location per end point direction. 15.4.7.1.1 device mode 15.4.7.1.1.1 tx fifo operation when allocating data ram for fifos in device mode keep in mind these factors: 1. receive fifo ram allocation: ? ram for setup packets: 4 * n + 6 locations must be reserved in the receive fifo to receive up to n setup packets on control endpoints, where n is the number of control endpoints the device core supports. the core does not use these locations, which are reserved for setup packets, to write any other data. ? one location for global out nak ? status information is written to the fifo along with each received packet. therefore, a minimum space of (largest packet size / 4) + 1 must be allotted to receive packets. if a high-bandwidth endpoint is enabled, or multiple isochronous endpoints are enabled, then at least two (largest
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 328 www.energymicro.com packet size / 4) + 1 spaces must be allotted to receive back-to-back packets. typically, two (largest packet size / 4) + 1 spaces are recommended so that when the previous packet is being transferred to ahb, the usb can receive the subsequent packet. if ahb latency is high, you must allocate enough space to receive multiple packets. this is critical to prevent dropping any isochronous packets. ? along with each endpoint's last packet, transfer complete status information is also pushed to the fifo. typically, one location for each out endpoint is recommended. 2. transmit fifo ram allocation: the minimum ram space required for each in endpoint transmit fifo is the maximum packet size for that particular in endpoint. more space allocated in the transmit in endpoint fifo results in a better performance on the usb and can hide latencies on the ahb. table 15.3. fifo name data ram size receive data fifo rx_fifo_size. this must include ram for setup packets, out endpoint control information and data out packets, as mentioned earlier. transmit fifo 0 tx_fifo_size[0] transmit fifo 1 tx_fifo_size[1] transmit fifo 2 tx_fifo_size[2] ... ... transmit fifo i tx_fifo_size[i] with this information, the following registers must be programmed as follows: 1. receive fifo size register (usb_grxfsiz) usb_grxfsiz.receive fifo depth = rx_fifo_size; 2. device in endpoint transmit fifo0 size register (usb_gnptxfsiz) usb_gnptxfsiz.non-periodic transmit fifo depth = tx_fifo_size[0]; usb_gnptxfsiz.non-periodic transmit ram start address = rx_fifo_size; 3. device in endpoint transmit fifo#1 size register (usb_dieptxf1) usb_dieptxf1. transmit ram start address = usb_gnptxfsiz.fifo0 transmit ram start address + tx_fifo_size[0]; 4. device in endpoint transmit fifo#2 size register (usb_dieptxf2) usb_dieptxf2.transmit ram start address = usb_dieptxf1.transmit ram start address + tx_fifo_size[1]; 5. device in endpoint transmit fifo#i size register (usb_dieptxfi) usb_dieptxfm.transmit ram start address = usb_dieptxfi-1.transmit ram start address + tx_fifo_size[i-1]; 6. the transmit fifos and receive fifo must be flushed after the ram allocation is done, for the proper functioning of the fifos. ? usb_grstctl.txfnum = 0x10 ? usb_grstctl.txfflsh = 1 ? usb_grstctl.rxfflsh = 1
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 329 www.energymicro.com the application must wait until the txfflsh bit and the rxfflsh bits are cleared before performing any operation on the core. 15.4.7.1.2 host mode considerations for allocating data ram for host mode fifos are listed here: receive fifo ram allocation: status information is written to the fifo along with each received packet. therefore, a minimum space of (largest packet size / 4) + 2 must be allotted to receive packets. if a high-bandwidth channel is enabled, or multiple isochronous channels are enabled, then at least two (largest packet size / 4) + 2 spaces must be allotted to receive back-to-back packets. typically, two (largest packet size / 4) + 2 spaces are recommended so that when the previous packet is being transferred to ahb, the usb can receive the subsequent packet. if ahb latency is high, you must allocate enough space to receive multiple packets. along with each host channel?s last packet, information on transfer complete status and channel halted is also pushed to the fifo. so two locations must be allocated for this. for handling nak in dma mode, the application must determine the number of control/bulk out endpoint data that must fit into the tx_fifo at the same instant. based on this, one location each is required for control/bulk out endpoints. for example, when the host addresses one control out endpoint and three bulk out endpoints, and all these must fit into the non-periodic tx_fifo at the same time, then four extra locations are required in the rx fifo to store the rewind status information for each of these endpoints. transmit fifo ram allocation the minimum amount of ram required for the host non-periodic transmit fifo is the largest maximum packet size among all supported non-periodic out channels. more space allocated in the transmit non-periodic fifo results in better performance on the usb and can hide ahb latencies. typically, two largest packet sizes? worth of space is recommended, so that when the current packet is under transfer to the usb, the ahb can get the next packet. if the ahb latency is large, then you must allocate enough space to buffer multiple packets. the minimum amount of ram required for host periodic transmit fifo is the largest maximum packet size among all supported periodic out channels. if there is at lease one high bandwidth isochronous out endpoint, then the space must be at least two times the maximum packet size of that channel. 15.4.7.1.2.1 internal register storage space allocation when operating in dma mode, the dma address register for each host channel (usb_hcx_dmaaddr) is stored in the fifo ram. one location for each channel must be reserved for this. table 15.4. fifo name data ram size receive data fifo rx_fifo_size non-periodic transmit fifo tx_fifo_size[0] in endpoint transmit fifo tx_fifo_size[1] with this information, the following registers must be programmed: 1. receive fifo size register (usb_grxfsiz) ? usb_grxfsiz.rxfdep = rx_fifo_size;
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 330 www.energymicro.com 2. non-periodic transmit fifo size register (usb_gnptxfsiz) ? usb_gnptxfsiz.nptxfdep = tx_fifo_size[0]; ? usb_gnptxfsiz.nptxfstaddr = rx_fifo_size; 3. host periodic transmit fifo size register (usb_hptxfsiz) ? usb_hptxfsiz.ptxfsize = tx_fifo_size[1]; ? usb_hptxfsiz.ptxfstaddr = usb_gnptxfsiz.nptxfstaddr + tx_fifo_size[0]; 4. the transmit fifos and receive fifo must be flushed after ram allocation for proper fifo function. ? usb_grstctl.txfnum = 0x10 ? usb_grstctl.txfflsh = 1 ? usb_grstctl.rxfflsh = 1 ? the application must wait until the txfflsh bit and the rxfflsh bits are cleared before performing any operation on the core. 15.4.7.1.3 summary of guidelines for choosing data fifo ram depth in host mode 15.4.7.1.3.1 rx fifo size the rx fifo size must be equal to at least twice the largest value of mps size used. the recommended minimum rxfifo depth = ((largest packet size/4)*2)+2. (+2) is required by the core for the status quadlets internally. 15.4.7.1.3.2 non periodic tx fifo size this should be equal to at least twice the largest value of mps size used. the recommended minimum non-periodic txfifo depth = ((largest packet size/4)*2). 15.4.7.1.3.3 periodic tx fifo size the recommended size for periodic txfifo is sum total of (mps*mc)/4 for all the channels. note note: in the above recommendations, always round off the mps value to the nearest multiple of 4. for example, if the largest value of mps=125, use the rounded-off value, which is 128. 15.4.7.1.4 calculating the total fifo size the rxfifo is shared between the host and device. the host txfifos are also shared with device in endpoint txfifos 0 through n. there are three ways to calculate the total fifo size. method 1 use this method if you are using the following conditions: ? minimum fifo depth allocation ? the fifo must equal at least one maxpacketsize (mps). device rxfifo = ? (4 * number of control endpoints + 6) + ((largest usb packet used / 4) + 1 for status information) + (2 * number of out endpoints) + 1 for global nak note include the control out endpoint in the number of out endpoints. host rxfifo =
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 331 www.energymicro.com ? slave mode minimum requirement: (largest usb packet used / 4) + 1 for status information + 1 transfer complete ? dma mode (largest usb packet used / 4) + 1 for status information + 1 transfer complete + 1 location each bulk/ control out endpoint for handling nak scenario host non-periodic txfifo = ? largest non-periodic usb packet used / 4 host periodic txfifo = ? sum total of (mps*mc)/4 of all periodic channels or 1500 locations, whichever is lower. device in endpoint txfifos (a separate fifo is allocated to each in endpoint) = ? in endpoints max packet size / 4 method 2 use this method if you are using the recommended minimum fifo depth allocation with support for high-bandwidth endpoints. this fifo allocation enables the core to transfer a packet on the usb while the previous (next) packet is simultaneously transferred to the ahb. this fifo allocation improves the core?s performance. device rxfifo = ? (4 * number of control endpoints + 6) + 2 * ((largest usb packet used / 4) + 1) +(2 * number of out endpoints) + 1 host rxfifo = ? slave mode 2 * ((largest usb packet used / 4) + 1 + 1) ? dma mode 2 * ((largest usb packet used / 4) + 1 + 1) + 1 location each bulk/control out endpoint for handling nak scenario host non-periodic txfifo = ? 2 * (largest non-periodic usb packet used / 4) host periodic txfifo = ? sum total of (mps*mc)/4 for all periodic channels or 1500 location, whichever is lower. device in endpoint-specific txfifos (a separate fifo is allocated to each endpoint) = ? 2 * (max_pkt_size for the endpoint) / 4. //dma mode otg total ram = (device rxfifo or host rxfifo; choose the largest one) +
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 332 www.energymicro.com ((host non-periodic txfifo + host peiodic txfifo) or (device in endpoint txfifo #0 + #1 + #2 + #n)); choose the largest one + (1 location per host channel or 1 location per device endpoint direction; choose the largest one) //slave mode otg total ram = (device rxfifo or host rxfifo; choose the largest one) + ((host non-periodic txfifo + host peiodic txfifo) or (device in endpoint txfifo #0 + #1 + #2 + #n)); choose the largest one method 3 use this method if you are using the recommended fifo depth allocation that supports high-bandwidth endpoints and high ahb latency. note ? x = (ahb latency + time to transfer largest packet on ahb) / time to transfer largest packet on usb. ? the value of x is an integer. any fractional value is rounded to the nearest integer. for example: x = 20 ms / 17,039 ms = 1.17 ms = 2 ms. device rxfifo = ? (4 * number of control endpoints + 6) + (x + 1) * ((largest usb packet used / 4) + 1)+ (2 * number of out endpoints) + 1 note include the control out endpoint in the number of out endpoints. host rxfifo = ? slave mode (x + 1) * ((largest usb packet used / 4) + 1 + 1) ? dma mode (x + 1) * ((largest usb packet used / 4) + 1 + 1) + 1 location each bulk/control out endpoint for handling nak scenario host non-periodic txfifo = ? (x + 1) * (largest non-periodic usb packet used / 4) host periodic txfifo = ? (x+1) * (sum total of (mps*mc)/4 of all periodic channels or 1500 locations, whichever is lower). device in endpoint-specific txfifos (a separate fifo is allocated to each endpoint) = ? (x+1)*(max_pkt_size for the endpoint)/4 //dma mode otg total ram = (device rxfifo or host rxfifo; choose the largest one) + ((host non-periodic txfifo + host periodic txfifo) or (device in endpoint txfifo #0 + #1 + #2 + #n); choose the largest one) + (1 location per host channel or 1 location per device endpoint direction; choose
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 333 www.energymicro.com the largest one) //slave mode otg total ram = (device rxfifo or host rxfifo; choose the largest one) + ((host non-periodic txfifo + host periodic txfifo) or (device in endpoint txfifo #0 + #1 + #2 + #n); choose the largest one) 15.4.7.2 dynamic fifo allocation the application can change the ram allocation for each fifo during the operation of the core. 15.4.7.2.1 host mode in host mode, before changing fifo data ram allocation, the application must determine the following. all channels are disabled ? all fifos are empty once these conditions are met, the application can reallocate fifo data ram as explained in data fifo ram allocation (p. 327 ) . after reallocating the fifo data ram, the application must flush all fifos in the core using the usb_grstctl.txfflsh (txfifo flush) and usb_grstctl.rxfflsh (rxfifo flush) fields. flushing is required to reset the pointers in the fifos for proper fifo operation after reallocation. for more information on flushing fifos, see flushing txfifos in the core (p. 333 ) and flushing rxfifos in the core (p. 334 ) . 15.4.7.2.2 device mode in device mode, before changing fifo data ram allocation, the application must determine the following. ? all in and out endpoints are disabled ? nak mode is enabled in the core on all in endpoints ? global out nak mode is enabled in the core ? all fifos are empty once these conditions are met, the application can reallocate fifo data ram as explained in data fifo ram allocation (p. 327 ) . when nak mode is enabled in the core, the core responds with a nak handshake on all tokens received on the usb, except for setup packets. after the reallocating the fifo data ram, the application must flush all fifos in the core using the usb_grstctl.txfflsh (txfifo flush) and usb_grstctl.rxfflsh (rxfifo flush) fields. flushing is required to reset the pointers in the fifos for proper fifo operation after reallocation. for more information on flushing fifos, see flushing txfifos in the core (p. 333 ) and flushing rxfifos in the core (p. 334 ) . 15.4.7.2.3 flushing txfifos in the core the application can flush all txfifos in the core using usb_grstctl.txfflsh as follows: 1. check that usb_gintsts.ginnakeff=0. if this bit is cleared then set usb_dctl.sgnpinnak=1. 2. wait for usb_gintsts.ginnakeff=1, which indicates the nak setting has taken effect to all in endpoints. 3. poll usb_grstctl.ahbidle until it is 1. ahbidle = h indicates that the core is not writing anything to the fifo.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 334 www.energymicro.com 4. check that usb_grstctl.txfflsh =0. if it is 0, then write the txfifo number you want to flush to usb_grstctl.txfnum. 5. set usb_grstctl.txfflsh=1and wait for it to clear. 6. set the usb_dctl.gcnpinnak bit. 15.4.7.2.4 flushing rxfifos in the core the application can flush all rxfifos in the core using usb_grstctl.rxfflsh as follows: 1. check the status of the usb_gintsts.goutnakeff bit. if it has been cleared, then set usb_dctl.sgoutnak=1. else, clear usb_gintsts.goutnakeff. nak effective interrupt = 1 indicates that the core is not writing to fifo. 2. wait for usb_gintsts.goutnakeff=1, which indicates the nak setting has taken effect to all out endpoints. 3. poll the usb_grstctl.ahbidle until it is 1. ahbidle = 1 indicates that the core is not reading anything from the fifo. 4. set usb_grstctl.rxfflsh=1 and wait for it to clear. 5. set the usb_dctl.gcoutnak bit. the core interrupt handler figure 15.36. core interrupt handler ot g _ int r _ handler wait for int errupt otg int errupt ? read usb_ gin t sts yes read usb_ gotgctl . generat e otg soft ware int errupt clear int errupt host / device com m on int errupt ? no yes generat e gobal soft ware int errupt no rtl in device m ode ? device global int errupt ? host global int errupt ? yes no clear int errupt generat e host global soft ware int errupt generat e device global soft ware int errupt yes yes no no host port int errupt ? read usb _ hprt generat e port - specific soft ware int errupt . yes no read usb_ haint read usb _ hc x _ int generat e channel - specific soft ware int errupt . read usb_ daint in endpoint int errupt ? read usb _ diep x _ int generat e in - endpoint - specific soft ware int errupt . yes no read usb _ doep x _ int generat e out - endpoint - specific soft ware int errupt .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 335 www.energymicro.com 15.4.8 suspend/resume and srp this chapter describes different methods of saving power when the usb is suspended. this chapter discusses the following topics: ? placing phy in low power mode without entering suspend (p. 335 ) ? when the core is in host mode (p. 335 ) ? when the core is in device mode (p. 336 ) ? suspend (p. 336 ) ? using em2 (p. 336 ) ? overview of the em2 programming model (p. 336 ) ? using em2 when the core is in host mode (p. 336 ) ? em2 when the core is in device mode (p. 339 ) ? clock gating (em0 and em1) (p. 341 ) ? internal clock gating when the core is in host mode (p. 341 ) ? internal clock gating when the core is in device mode (p. 342 ) 15.4.8.1 placing phy in low power mode without entering suspend the core can place the phy in low power mode (the differential receiver is disabled) without entering suspend. 15.4.8.1.1 when the core is in host mode programming flow for the host core to put phy in low power mode 1. to turn off port power, perform write operation to set the following bits in the usb_hprt register: ? usb_hprt.prtpwr = 0; ? usb_hprt.prtena = 0; 2. to put phy in low power mode, perform read-modify-write operation to set the following bits in the usb_pcgcctl register: ? usb_pcgcctl.stoppclk = 1 ? usb_pcgcctl.gatehclk = 0 programming flow for the host core to make phy exit low power mode if your device is non-srp capable, the host must implement polling to detect the device connection by turning on the port and exiting phy low power mode periodically and checking for connect. 1. to turn on port power, perform write operation to set the following bits in the usb_hprt register: ? usb_hprt.prtpwr = 1 ? usb_hprt.prtena = 0 2. to exit phy low power mode, perform read-modify-write operation to set the following bits in the usb_pcgcctl register: ? usb_pcgcctl.stoppclk = 0 ? usb_pcgcctl.stophclk = 0 3. wait for the usb_hprt port connect detected (prtconndet) bit to be set and do the enumeration of the device. if your device is srp-capable, when the device initiates srp request, the host core asynchronously detects srp and the phy exits low power mode. 1. wait for session request from the device, or new session detected interrupt (sessreqint) in the usb_gintsts register. 2. to turn on port power, perform write operation to set the following bits in the usb_hprt register:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 336 www.energymicro.com ? usb_hprt.prtpwr = 1 ? usb_hprt.prtena = 0 3. wait for the usb_hprt port connect detected (prtconndet) bit to be set and do the enumeration of device. 15.4.8.1.2 when the core is in device mode to make phy enter low power mode, complete the following steps: 1. ensure that the following signals are set as follows: ? vbus voltage level must be below the session valid level (vbus is not active) ? dp/dm must be se0 2. from the application, perform read-modify-write operation to set usb_pcgcctl.stoppclk = 1. 15.4.8.2 suspend when the core is in suspend, the following power conservation options are available to use: ? using em2 (p. 336 ) : you can enter em2, turning off power (and reseting) parts of the core ? clock gating (em0 and em1) (p. 341 ) : you can choose gate the ahb clock to some parts of the core internal clock gating when the core is in host mode (p. 341 ) this section discusses methods of conserving power by using one of the above methods. 15.4.8.2.1 using em2 15.4.8.2.1.1 overview of the em2 programming model when the usb is suspended or the session is not valid, the phy is driven into suspend mode, stopping the phy clock to reduce power consumption in the phy and the core. to further reduce power consumption, the core also supports ahb clock gating and using em2. the following sections show the procedures you must follow to use em2 while in suspend/session-off. during em2, the clock to the core must be switched to one of the 32 khz sources (lfrco or lfxo). this core needs this clock to detect resume and srp events. 15.4.8.2.1.2 em2 when the core is in host mode host mode suspend in em2 sequence of operations: 1. back up the essential registers of the core. read and store the following core registers: ? usb_gintmsk ? usb_gotgctl ? usb_gahbcfg ? usb_gusbcfg ? usb_grxfsiz ? usb_gnptxfsiz ? usb_dcfg ? usb_dctl ? usb_daintmsk ? usb_diepmsk ? usb_doepmsk ? usb_diepx_ctl ? usb_diepx_tsiz ? usb_diepx_dmaaddr ? usb_pcgcctl ? usb_dieptxfn 2. the application sets the port suspend bit in the host port csr, and the core drives a usb suspend.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 337 www.energymicro.com 3. the application sets the power clamp bit in the power and clock gating control register. 4. the application sets the reset to power-down modules bit in the power and clock gating control register. 5. the application sets the stop phy clock bit in the power and clock gating control register, the core suspends the phy and the phy clock stops. if usb_hcfg.ena32khzs is set, switch the usbc clock to 32 khz. 6. enter em2. host mode resume in em2 sequence of operations: 1. the resume event starts by the application waking up from em2 (on an interrupt) 2. switch usbc clock back to 48 mhz. 3. the application clears the stop phy clock bit and the core takes the phy back to normal mode. the phy clock starts up. 4. the application clears the power clamp bit. the core starts driving resume signaling on the usb. 5. the application clears the reset to power-down modules bit. 6. the application programs registers in the csr and sets the port resume bit in host port csr (setting the port resume bit is required by the core, although resume signaling starts earlier). 7. the application clears the port resume bit and the core stops driving resume signaling. the core is in normal operating mode. note the application must insert delays of at least 2 phy clocks between all steps in this sequence. this requirement applies to all usb em2 programming sequences. host mode remote wakeup in em2 sequence of operations: 1. the core detects remote wakeup signaling on the usb. the phy exits suspend mode and the phy clock restarts. 2. the core generates a remote wakeup detected interrupt. the remote wakeup interrupt is generated using the 32 khz clock depending on the usb_hcfg.resvalid (resumevalidperiod) programmed. the host core starts resume signaling at this stage. 3. the usbc clock is switched back to normal 48 mhz clock. 4. the application clears the stop phy clock bit. 5. the application clears the power clamp bit. 6. the application clears the reset to power-down modules bit 7. the application programs csrs and sets the port resume bit. the core continues to drive resume signaling on the usb. 8. the application clears the port resume bit and the core stops driving resume signaling. the core enters normal operating mode. host mode session end in em2 sequence of operations: 1. back up the essential registers of the core. read and store the following core registers: ? usb_gintmsk ? usb_gotgctl ? usb_dctl ? usb_daintmsk
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 338 www.energymicro.com ? usb_gahbcfg ? usb_gusbcfg ? usb_grxfsiz ? usb_gnptxfsiz ? usb_dcfg ? usb_diepmsk ? usb_doepmsk ? usb_diepx_ctl ? usb_diepx_tsiz ? usb_diepx_dmaaddr ? usb_pcgcctl ? usb_dieptxfn 2. the application sets the port suspend bit in the host port csr and the core drives a usb suspend. 3. the application clears the port power bit. 4. the application sets the power clamp bit in the power and clock gating control register, and the core clamps the signals between the internal modules on different power rails. 5. the application sets the reset to power-down modules bit in the power and clock gating control register. 6. the application sets the stop phy clock bit in the power and clock gating control register, and the core suspends the phy, stopping the phy clock. 7. switch usbc clock to 32 khz. 8. enter em2. host mode session start (em2 -> em0) sequence of operations: 1. exit em2/enter em0). 2. switch usbc clock back to 48 mhz. 3. the application clears the stop phy clock bit. 4. the application clears the power clamp bit. the application clears the reset to power-down modules bit. 5. the application programs csrs and sets the port power bit to turn on vbus. 6. the core detects the connection and drives the usb reset. the core enters normal operating mode. host mode session end (em0 -> em2) sequence of operations: 1. back up the essential registers of the core. read and store the following core registers: ? usb_gintmsk ? usb_gotgctl ? usb_gahbcfg ? usb_gusbcfg ? usb_grxfsiz ? usb_gnptxfsiz ? usb_dcfg ? usb_dctl ? usb_daintmsk ? usb_diepmsk ? usb_doepmsk ? usb_diepx_ctl ? usb_diepx_tsiz ? usb_diepx_dmaaddr ? usb_pcgcctl ? usb_dieptxfn 2. the application sets the port suspend bit in the host port csr and the core drives a usb suspend. 3. the application clears the port power bit. 4. the application sets the power clamp bit in the power and clock gating control register, and the core clamps the signals between the internal modules on different power rails. 5. the application sets the reset to power-down modules bit in the power and clock gating control register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 339 www.energymicro.com 6. the application sets the stop phy clock bit in the power and clock gating control register. 7. enter em2. host mode sessions start (srp) (em2 -> em0) sequence of operations: 1. the core detects srp (data line pulsing) on the bus. the core de-asserts the suspend_n signal to the phy, generating the phy clock. the srp detected interrupt is generated. 2. the application clears the stop phy clock bit, the core deasserts the suspend_n signal to the phy to generate the phy clock. 3. the power (vdd_dn) is turned on and stabilizes. 4. the application clears the power clamp bit. 5. the application clears the reset to power-down modules bit. 6. the application programs the csrs, and sets the port power bit to turn on vbus. 7. the core detects device connection and drives a usb reset. the core enters normal operating mode. 15.4.8.2.1.3 em2 when the core is in device mode device mode suspend with em2 in device mode, the device validates the host-driven resume signal for a period of 1.5 s (75 clock cycles at 48 mhz). with a 32-khz clock, 2.34 ms is required (75 clock cycles at 32 khz) to detect the resume. hence, the application programs usb_dcfg.resvalid with a value of 4 clock cycles (125 s). if the core is in suspend mode, the device thus detects the resume and the host signals a resume for a minimum of 125 s. if the device is being reset from suspend, it begins a high-speed detection handshake after detecting se0 for no fewer than 2.5 s. with a 48-mhz clock, detection occurs after 120 clock cycles (2.5 s). with a 32-khz clock, 120 clock cycles signifies 3.75 msec. hence, a programmable value of 4 clock cycles (125 s) is used to detect reset. the 32-khz suspend feature incorporates switching to the 32-khz clock during suspend and resume/ remote wakeup until the system comes up and starts driving 48 mhz. sequence of operations: 1. detect suspend state. wait for an interrupt from the device core and check that usb_gintsts.usbsusp is set to 1. 2. back up the essential registers of the core. read and store the following core registers: ? usb_gintmsk ? usb_gotgctl ? usb_gahbcfg ? usb_gusbcfg ? usb_grxfsiz ? usb_gnptxfsiz ? usb_dcfg ? usb_dctl ? usb_daintmsk ? usb_diepmsk ? usb_doepmsk ? usb_diepx_ctl ? usb_diepx_tsiz ? usb_diepx_dmaaddr ? usb_pcgcctl ? usb_dieptxfn 3. the application sets the pwrclmp bit in the power and clock gating control (usb_pcgcctl) register. 4. the application sets the usb_pcgcctl.rstpdwnmodule bit.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 340 www.energymicro.com 5. the application sets the usb_pcgcctl.stoppclk bit. 6. switch usb core clock (usbc) to 32 khz. 7. enter em2. device mode resume (em2 -> em0) sequence if operations: 1. the core detects resume signaling on the usb. the core generates a resume detected interrupt. 2. switch usb core clock (usbc) back to 48 mhz. 3. the application clears the stoppclk bit. 4. the application clears the usb_pcgcctl.pwrclmp and usb_pcgcctl.rstpdwnmodule bits. 5. restore the usb_gusbcfg and usb_dcfg registers with the values stored during the save operation before entering em2. 6. restore the following core registers with the values stored during the save operation before entering em2: ? usb_gintmsk ? usb_gotgctl ? usb_gusbcfg ? usb_grxfsiz ? usb_gnptxfsiz ? usb_daintmsk ? usb_diepmsk ? usb_doepmsk ? usb_diepx_ctl ? usb_diepx_tsiz ? usb_diepx_dmaaddr ? usb_dieptxfn 7. the application programs csrs, then sets the power-on programming done bit in the device control register. device mode remote wakeup (em2 -> em0) sequence if operations: 1. an interrupt wakes up the device from em2. 2. switch usb core clock (usbc) back to 48 mhz. 3. the application clears the stoppclk and gatehclk bits in the usb_pcgcctl register. 4. the application clears the usb_pcgcctl.pwrclmp and usb_pcgcctl.rstpdwnmodule bits. 5. restore the usb_gusbcfg and usb_dcfg registers with the values stored during the save operation before entering em2 . 6. drive remote wakeup from the core. program usb_dctl by performing write-only operation with the following values: ? usb_dctl.rmtwkupsig = 1 ? other bits = value stored during the save operation before entering em2 7. clear all interrupt status. wait for at least 1 millisecond of remote wakeup time and then program ginsts register with 0xffffffff to clear all the status register fields. 8. restore the following core registers with the values stored during the save operation before entering em2: ? usb_gintmsk ? usb_gotgctl ? usb_gusbcfg ? usb_grxfsiz ? usb_gnptxfsiz ? usb_daintmsk ? usb_diepmsk ? usb_doepmsk ? usb_diepx_ctl ? usb_diepx_tsiz ? usb_diepx_dmaaddr ? usb_dieptxfn
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 341 www.energymicro.com 9. wait for remote wakeup time (1-15ms) and then program usb_dctl by performing read-modify- write to set usb_dctl.rmtwkupsig = 0. device mode session end (em0 -> em2) sequence of operations: 1. the core detects a usb suspend and generates a suspend detected interrupt. the host turns off vbus. 2. the application sets the power clamp bit in the power and clock gating control register. 3. the application sets the reset to power-down modules bit in the power and clock gating control register. 4. the application sets the stop phy clock bit in the power and clock gating control register. 5. switch usb core clock (usbc) to 32 khz. 6. enter em2. device mode session start (em2 -> em0) sequence of operations: 1. the core detects vbus on (voltage level within session-valid). a new session detected interrupt is generated. 2. switch usb core clock (usbc) back to 48 mhz. 3. the application clears the stop phy clock bit. 4. the application clears the power clamp bit. 5. the application clears the reset to power-down modules bit. 6. the application programs csrs. 7. the cores detects a usb reset. the core enters normal operating mode. 15.4.8.2.2 using clock gating in em0/em1 the core supports hclk gating to reduce dynamic power to internal modules to the core during suspend/ session-off state in em0 and em1. 15.4.8.2.2.1 internal clock gating when the core is in host mode the following sections show the procedures you must follow to use the clock gating feature. host mode suspend and resume with clock gating sequence of operations: 1. the application sets the port suspend bit in the host port csr, and the core drives a usb suspend. 2. the application sets the stop phy clock bit in the power and clock gating control register. the application sets the gate hclk bit in the power and clock gating control register, the core gates the hclk internally. 3. the core remains in suspend mode. 4. the application clears the gate hclk and stop phy clock bits, and the phy clock is generated. 5. the application sets the port resume bit, and the core starts driving resume signaling. 6. the application clears the port resume bit after at least 20 ms. 7. the core is in normal operating mode. host mode suspend and remote wakeup with clock gating sequence of operations:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 342 www.energymicro.com 1. the application sets the port suspend bit in the host port csr, and the core drives a usb suspend. 2. the application sets the stop phy clock bit in the power and clock gating control register. the application sets the gate hclk bit in the power and clock gating control register, and the core gates hclk internally. 3. the core remains in suspend mode 4. the remote wakeup signaling from the device is detected. the core generates a remote wakeup detected interrupt. 5. the application clears the gate hclk and stop phy clock bits. the core sets the port resume bit. 6. the application clears the port resume bit after at least 20 ms. 7. the core is in normal operating mode. host mode session end and start with clock gating sequence of operations: 1. the application sets the port suspend bit in the host port csr, and the core drives a usb suspend. 2. the application clears the port power bit. the core turns off vbus. 3. the application sets the stop phy clock bit in the power and clock gating control register. the application sets the gate hclk bit in the power and clock gating control register, and the core gates hclk internally. 4. the core remains in low-power mode. 5. the application clears the gate hclk bit and the application clears the stop phy clock bit to start the phy clock. 6. the application sets the port power bit to turn on vbus. 7. the core detects device connection and drives a usb reset. 8. the core is in normal operating mode. host mode session end and srp with clock gating sequence of operations: 1. the application sets the port suspend bit in the host port csr, and the core drives a usb suspend. 2. the application clears the port power bit. the core turns off vbus. 3. the application sets the stop phy clock bit in the power and clock gating control register. the application sets the gate hclk bit in the power and clock gating control register, and the core gates hclk internally. 4. the core remains in low-power mode. 5. srp (data line pulsing) from the device is detected. an srp request detected interrupt is generated. 6. the application clears the gate hclk bit and the stop phy clock bit. 7. the core sets the port power bit to turn on vbus. 8. the core detects device connection and drives a usb reset. 9. the core is in normal operating mode. 15.4.8.2.2.2 internal clock gating when the core is in device mode the following sections show the procedures you must follow to use the clock gating feature. device mode suspend and resume with clock gating sequence of operations: 1. the core detects a usb suspend and generates a suspend detected interrupt. 2. the application sets the stop phy clock bit in the power and clock gating control register. the application sets the gate hclk bit in the power and clock gating control register, and the core gates hclk.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 343 www.energymicro.com 3. the core remains in suspend mode. 4. the resume signaling from the host is detected. a resume detected interrupt is generated. 5. the application clears the gate hclk bit and the stop phy clock bit. 6. the host finishes resume signaling. 7. the core is in normal operating mode. device mode suspend and remote wakeup with clock gating sequence of operations: 1. the core detects a usb suspend and generates a suspend detected interrupt. 2. the application sets the stop phy clock bit in the power and clock gating control register. the application sets the gate hclk bit in the power and clock gating control register, the core gates hclk. 3. the core remains in suspend mode. 4. the application clears the gate hclk bit and the stop phy clock bit. 5. the application sets the remote wakeup bit in the device control register, the core starts driving remote wakeup signaling. 6. the host drives resume signaling. 7. the core is in normal operating mode. device mode session end and start with clock gating sequence of operations: 1. the core detects a usb suspend, and generates a suspend detected interrupt. the host turns off vbus. 2. the application sets the stop phy clock bit in the power and clock gating control register. the application sets the gate hclk bit in the power and clock gating control register, and the core gates hclk. 3. the core remains in low-power mode. 4. the new session is detected (a session-valid voltage is detected). a new session detected interrupt is generated. 5. the application clears the gate hclk and stop phy clock bits. 6. the core detects usb reset. 7. the core is in normal operating mode device mode session end and srp with clock gating sequence of operations: 1. the core detects a usb suspend, and generates a suspend detected interrupt. the host turns off vbus. 2. the application sets the stop phy clock bit in the power and clock gating control register. the application sets the gate hclk bit in the power and clock gating control register, and the core gates hclk. 3. the core remains in low-power mode. 4. the application clears the gate hclk and stop phy clock bits. 5. the application sets the srp request bit, and the core drives data line and vbus pulsing. 6. the host turns on vbus, detects device connection, and drives a usb reset. 7. the core is in normal operating mode. 15.4.9 register usage only the core global, power and clock gating, data fifo access, and host port registers can be accessed in both host and device modes. when the core is operating in one mode, either device or
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 344 www.energymicro.com host, the application must not access registers from the other mode. if an illegal access occurs, a mode mismatch interrupt is generated and reflected in the core interrupt register (usb_gintsts.modemis). when the core switches from one mode to another, the registers in the new mode must be reprogrammed as they would be after a power-on reset. the memory map for the core is as follows: ? core global registers are located in the address offset-range [0x3c000, 0x3c3ff] and typically start with first letter g. ? host mode registers are located in the address offset-range [0x3c400, 0x3c7ff] and start with first letter h. ? device mode registers are located in the address offset-range [0x3c800, 0x3cdff] and start with first letter d. ? the power and clock gating register is located at offset 0x3ce00. ? the device ep/host channel fifos start at address offset 0x3d000 with 4k spacing. these registers, available in both host and device modes, are used to read or write the fifo space for a specific endpoint or a channel, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel. ? the direct ram access area start at address offset 0x5c000.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 345 www.energymicro.com 15.5 register map the offset register address is relative to the registers base address. offset name type description 0x000 usb_ctrl rw system control register 0x004 usb_status r system status register 0x008 usb_if r interrupt flag register 0x00c usb_ifs w1 interrupt flag set register 0x010 usb_ifc w1 interrupt flag clear register 0x014 usb_ien rw interrupt enable register 0x018 usb_route rw i/o routing register 0x3c000 usb_gotgctl rwh otg control and status register 0x3c004 usb_gotgint rw1 otg interrupt register 0x3c008 usb_gahbcfg rw ahb configuration register 0x3c00c usb_gusbcfg rwh usb configuration register 0x3c010 usb_grstctl rwh reset register 0x3c014 usb_gintsts rwh interrupt register 0x3c018 usb_gintmsk rw interrupt mask register 0x3c01c usb_grxstsr r receive status debug read register 0x3c020 usb_grxstsp r receive status read and pop register 0x3c024 usb_grxfsiz rw receive fifo size register 0x3c028 usb_gnptxfsiz rw non-periodic transmit fifo size register 0x3c02c usb_gnptxsts r non-periodic transmit fifo/queue status register 0x3c05c usb_gdfifocfg rw global dfifo configuration register 0x3c100 usb_hptxfsiz rw host periodic transmit fifo size register 0x3c104 usb_dieptxf1 rw device in endpoint transmit fifo 1 size register 0x3c108 usb_dieptxf2 rw device in endpoint transmit fifo 2 size register 0x3c10c usb_dieptxf3 rw device in endpoint transmit fifo 3 size register 0x3c110 usb_dieptxf4 rw device in endpoint transmit fifo 4 size register 0x3c114 usb_dieptxf5 rw device in endpoint transmit fifo 5 size register 0x3c118 usb_dieptxf6 rw device in endpoint transmit fifo 6 size register 0x3c400 usb_hcfg rw host configuration register 0x3c404 usb_hfir rw host frame interval register 0x3c408 usb_hfnum r host frame number/frame time remaining register 0x3c410 usb_hptxsts r host periodic transmit fifo/queue status register 0x3c414 usb_haint r host all channels interrupt register 0x3c418 usb_haintmsk rw host all channels interrupt mask register 0x3c440 usb_hprt rwh host port control and status register 0x3c500 usb_hc0_char rw host channel x characteristics register 0x3c508 usb_hc0_int rw1 host channel x interrupt register 0x3c50c usb_hc0_intmsk rw host channel x interrupt mask register 0x3c510 usb_hc0_tsiz rw host channel x transfer size register 0x3c514 usb_hc0_dmaaddr rw host channel x dma address register ... usb_hcx_char rw host channel x characteristics register
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 346 www.energymicro.com offset name type description ... usb_hcx_int rw1 host channel x interrupt register ... usb_hcx_intmsk rw host channel x interrupt mask register ... usb_hcx_tsiz rw host channel x transfer size register ... usb_hcx_dmaaddr rw host channel x dma address register 0x3c6a0 usb_hc13_char rw host channel x characteristics register 0x3c6a8 usb_hc13_int rw1 host channel x interrupt register 0x3c6ac usb_hc13_intmsk rw host channel x interrupt mask register 0x3c6b0 usb_hc13_tsiz rw host channel x transfer size register 0x3c6b4 usb_hc13_dmaaddr rw host channel x dma address register 0x3c800 usb_dcfg rw device configuration register 0x3c804 usb_dctl rwh device control register 0x3c808 usb_dsts r device status register 0x3c810 usb_diepmsk rw device in endpoint common interrupt mask register 0x3c814 usb_doepmsk rw device out endpoint common interrupt mask register 0x3c818 usb_daint r device all endpoints interrupt register 0x3c81c usb_daintmsk rw device all endpoints interrupt mask register 0x3c828 usb_dvbusdis rw device vbus discharge time register 0x3c82c usb_dvbuspulse rw device vbus pulsing time register 0x3c834 usb_diepempmsk rw device in endpoint fifo empty interrupt mask register 0x3c900 usb_diep0ctl rwh device in endpoint 0 control register 0x3c908 usb_diep0int rwh device in endpoint 0 interrupt register 0x3c910 usb_diep0tsiz rw device in endpoint 0 transfer size register 0x3c914 usb_diep0dmaaddr rw device in endpoint 0 dma address register 0x3c918 usb_diep0txfsts r device in endpoint 0 transmit fifo status register 0x3c920 usb_diep0_ctl rwh device in endpoint x+1 control register 0x3c928 usb_diep0_int rwh device in endpoint x+1 interrupt register 0x3c930 usb_diep0_tsiz rw device in endpoint x+1 transfer size register 0x3c934 usb_diep0_dmaaddr rw device in endpoint x+1 dma address register 0x3c938 usb_diep0_txfsts r device in endpoint x+1 transmit fifo status register 0x3c940 usb_diep1_ctl rwh device in endpoint x+1 control register 0x3c948 usb_diep1_int rwh device in endpoint x+1 interrupt register 0x3c950 usb_diep1_tsiz rw device in endpoint x+1 transfer size register 0x3c954 usb_diep1_dmaaddr rw device in endpoint x+1 dma address register 0x3c958 usb_diep1_txfsts r device in endpoint x+1 transmit fifo status register 0x3c960 usb_diep2_ctl rwh device in endpoint x+1 control register 0x3c968 usb_diep2_int rwh device in endpoint x+1 interrupt register 0x3c970 usb_diep2_tsiz rw device in endpoint x+1 transfer size register 0x3c974 usb_diep2_dmaaddr rw device in endpoint x+1 dma address register 0x3c978 usb_diep2_txfsts r device in endpoint x+1 transmit fifo status register 0x3c980 usb_diep3_ctl rwh device in endpoint x+1 control register 0x3c988 usb_diep3_int rwh device in endpoint x+1 interrupt register 0x3c990 usb_diep3_tsiz rw device in endpoint x+1 transfer size register
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 347 www.energymicro.com offset name type description 0x3c994 usb_diep3_dmaaddr rw device in endpoint x+1 dma address register 0x3c998 usb_diep3_txfsts r device in endpoint x+1 transmit fifo status register 0x3c9a0 usb_diep4_ctl rwh device in endpoint x+1 control register 0x3c9a8 usb_diep4_int rwh device in endpoint x+1 interrupt register 0x3c9b0 usb_diep4_tsiz rw device in endpoint x+1 transfer size register 0x3c9b4 usb_diep4_dmaaddr rw device in endpoint x+1 dma address register 0x3c9b8 usb_diep4_txfsts r device in endpoint x+1 transmit fifo status register 0x3c9c0 usb_diep5_ctl rwh device in endpoint x+1 control register 0x3c9c8 usb_diep5_int rwh device in endpoint x+1 interrupt register 0x3c9d0 usb_diep5_tsiz rw device in endpoint x+1 transfer size register 0x3c9d4 usb_diep5_dmaaddr rw device in endpoint x+1 dma address register 0x3c9d8 usb_diep5_txfsts r device in endpoint x+1 transmit fifo status register 0x3cb00 usb_doep0ctl rwh device out endpoint 0 control register 0x3cb08 usb_doep0int rw1 device out endpoint 0 interrupt register 0x3cb10 usb_doep0tsiz rw device out endpoint 0 transfer size register 0x3cb14 usb_doep0dmaaddr rw device out endpoint 0 dma address register 0x3cb20 usb_doep0_ctl rwh device out endpoint x+1 control register 0x3cb28 usb_doep0_int rw1 device out endpoint x+1 interrupt register 0x3cb30 usb_doep0_tsiz rwh device out endpoint x+1 transfer size register 0x3cb34 usb_doep0_dmaaddr rw device out endpoint x+1 dma address register 0x3cb40 usb_doep1_ctl rwh device out endpoint x+1 control register 0x3cb48 usb_doep1_int rw1 device out endpoint x+1 interrupt register 0x3cb50 usb_doep1_tsiz rwh device out endpoint x+1 transfer size register 0x3cb54 usb_doep1_dmaaddr rw device out endpoint x+1 dma address register 0x3cb60 usb_doep2_ctl rwh device out endpoint x+1 control register 0x3cb68 usb_doep2_int rw1 device out endpoint x+1 interrupt register 0x3cb70 usb_doep2_tsiz rwh device out endpoint x+1 transfer size register 0x3cb74 usb_doep2_dmaaddr rw device out endpoint x+1 dma address register 0x3cb80 usb_doep3_ctl rwh device out endpoint x+1 control register 0x3cb88 usb_doep3_int rw1 device out endpoint x+1 interrupt register 0x3cb90 usb_doep3_tsiz rwh device out endpoint x+1 transfer size register 0x3cb94 usb_doep3_dmaaddr rw device out endpoint x+1 dma address register 0x3cba0 usb_doep4_ctl rwh device out endpoint x+1 control register 0x3cba8 usb_doep4_int rw1 device out endpoint x+1 interrupt register 0x3cbb0 usb_doep4_tsiz rwh device out endpoint x+1 transfer size register 0x3cbb4 usb_doep4_dmaaddr rw device out endpoint x+1 dma address register 0x3cbc0 usb_doep5_ctl rwh device out endpoint x+1 control register 0x3cbc8 usb_doep5_int rw1 device out endpoint x+1 interrupt register 0x3cbd0 usb_doep5_tsiz rwh device out endpoint x+1 transfer size register 0x3cbd4 usb_doep5_dmaaddr rw device out endpoint x+1 dma address register 0x3ce00 usb_pcgcctl rwh power and clock gating control register 0x3d000 usb_fifo0d0 rw device ep 0/host channel 0 fifo
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 348 www.energymicro.com offset name type description ... usb_fifo0dx rw device ep 0/host channel 0 fifo 0x3d7fc usb_fifo0d511 rw device ep 0/host channel 0 fifo 0x3e000 usb_fifo1d0 rw device ep 1/host channel 1 fifo ... usb_fifo1dx rw device ep 1/host channel 1 fifo 0x3e7fc usb_fifo1d511 rw device ep 1/host channel 1 fifo 0x3f000 usb_fifo2d0 rw device ep 2/host channel 2 fifo ... usb_fifo2dx rw device ep 2/host channel 2 fifo 0x3f7fc usb_fifo2d511 rw device ep 2/host channel 2 fifo 0x40000 usb_fifo3d0 rw device ep 3/host channel 3 fifo ... usb_fifo3dx rw device ep 3/host channel 3 fifo 0x407fc usb_fifo3d511 rw device ep 3/host channel 3 fifo 0x41000 usb_fifo4d0 rw device ep 4/host channel 4 fifo ... usb_fifo4dx rw device ep 4/host channel 4 fifo 0x417fc usb_fifo4d511 rw device ep 4/host channel 4 fifo 0x42000 usb_fifo5d0 rw device ep 5/host channel 5 fifo ... usb_fifo5dx rw device ep 5/host channel 5 fifo 0x427fc usb_fifo5d511 rw device ep 5/host channel 5 fifo 0x43000 usb_fifo6d0 rw device ep 6/host channel 6 fifo ... usb_fifo6dx rw device ep 6/host channel 6 fifo 0x437fc usb_fifo6d511 rw device ep 6/host channel 6 fifo 0x44000 usb_fifo7d0 rw host channel 7 fifo ... usb_fifo7dx rw host channel 7 fifo 0x447fc usb_fifo7d511 rw host channel 7 fifo 0x45000 usb_fifo8d0 rw host channel 8 fifo ... usb_fifo8dx rw host channel 8 fifo 0x457fc usb_fifo8d511 rw host channel 8 fifo 0x46000 usb_fifo9d0 rw host channel 9 fifo ... usb_fifo9dx rw host channel 9 fifo 0x467fc usb_fifo9d511 rw host channel 9 fifo 0x47000 usb_fifo10d0 rw host channel 10 fifo ... usb_fifo10dx rw host channel 10 fifo 0x477fc usb_fifo10d511 rw host channel 10 fifo 0x48000 usb_fifo11d0 rw host channel 11 fifo ... usb_fifo11dx rw host channel 11 fifo 0x487fc usb_fifo11d511 rw host channel 11 fifo 0x49000 usb_fifo12d0 rw host channel 12 fifo ... usb_fifo12dx rw host channel 12 fifo 0x497fc usb_fifo12d511 rw host channel 12 fifo 0x4a000 usb_fifo13d0 rw host channel 13 fifo ... usb_fifo13dx rw host channel 13 fifo 0x4a7fc usb_fifo13d511 rw host channel 13 fifo 0x5c000 usb_fiforam0 rw direct access to data fifo ram for debugging (2 kb)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 349 www.energymicro.com offset name type description ... usb_fiforamx rw direct access to data fifo ram for debugging (2 kb) 0x5c7fc usb_fiforam511 rw direct access to data fifo ram for debugging (2 kb) 15.6 register description 15.6.1 usb_ctrl - system control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0 0 0 0 access rw rw rw rw rw rw name biasprogem23 biasprogem01 vregosen vregdis dmpuap vbusenap bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:24 biasprogem23 0x0 rw regulator bias programming value in em2/3 regulator bias current setting in em2/3 (i.e. while usb in suspend). 23:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21:20 biasprogem01 0x0 rw regulator bias programming value in em0/1 regulator bias current setting in em0/1 (i.e. while usb active). 19:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17 vregosen 0 rw vrego sense enable set this bit to enable usb_vrego voltage level sensing. 16 vregdis 0 rw voltage regulator disable set this bit to disable the voltage regulator. 15:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 dmpuap 0 rw dmpu active polarity use this bit to select the active polarity of the usb_dmpu pin. value mode description 0 low usb_dmpu is active low. 1 high usb_dmpu is active high. 0 vbusenap 0 rw vbusen active polarity use this bit to select the active polarity of the usb_vbusen pin. value mode description 0 low usb_vbusen is active low. 1 high usb_vbusen is active high.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 350 www.energymicro.com 15.6.2 usb_status - system status register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access r name vregos bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 vregos 0 r vrego sense output usb_vrego voltage sense output. 0 when no usb_vrego voltage, 1 when usb_vrego above approximately 1.8 v. always 0 when vregosen in usb_ctrl is 0. 15.6.3 usb_if - interrupt flag register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 1 access r r name vregosl vregosh bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 vregosl 1 r vrego sense low interrupt flag set when usb_vrego drops below approximately 1.8 v. 0 vregosh 1 r vrego sense high interrupt flag set when usb_vrego goes above approximately 1.8 v. 15.6.4 usb_ifs - interrupt flag set register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name vregosl vregosh bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 351 www.energymicro.com bit name reset access description 1 vregosl 0 w1 set vrego sense low interrupt flag write to 1 to set the vrego sense low interrupt flag. 0 vregosh 0 w1 set vrego sense high interrupt flag write to 1 to set the vrego sense high interrupt flag. 15.6.5 usb_ifc - interrupt flag clear register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name vregosl vregosh bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 vregosl 0 w1 clear vrego sense low interrupt flag write to 1 to clear the vrego sense low interrupt flag. 0 vregosh 0 w1 clear vrego sense high interrupt flag write to 1 to clear the vrego sense high interrupt flag. 15.6.6 usb_ien - interrupt enable register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access rw rw name vregosl vregosh bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 vregosl 0 rw vrego sense low interrupt enable enable interrupt on vrego sense low. 0 vregosh 0 rw vrego sense high interrupt enable enable interrupt on vrego sense high.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 352 www.energymicro.com 15.6.7 usb_route - i/o routing register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access rw rw rw name dmpupen vbusenpen phypen bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 dmpupen 0 rw dmpu pin enable when set, the usb_dmpu pin is enabled. 1 vbusenpen 0 rw vbusen pin enable when set, the usb_vbusen pin is enabled. 0 phypen 0 rw usb phy pin enable when set, the usb phy and usb pins are enabled. the usb_dp and usb_dm are changed from regular gpio pins to usb pins. 15.6.8 usb_gotgctl - otg control and status register the otg control and status register controls the behavior and reflects the status of the otg function of the core. offset bit position 0x3c000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 access rw r r r r rw rw rw r rw rw rw rw rw rw rw r name otgver bsesvld asesvld dbnctime conidsts devhnpen hstsethnpen hnpreq hstnegscs avalidovval avalidoven bvalidovval bvalidoven vbvalidovval vbvalidoven sesreq sesreqscs bit name reset access description 31:21 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 20 otgver 0 rw otg version indicates the otg revision. value mode description 0 otg13 otg version 1.3. in this version the core supports data line pulsing and vbus pulsing for srp. 1 otg20 otg version 2.0. in this version the core supports only data line pulsing for srp. 19 bsesvld 0 r b-session valid (device only) indicates the device mode transceiver status for b-session valid. in otg mode, you can use this bit to determine if the device is connected or disconnected. 18 asesvld 0 r a-session valid (host only) indicates the host mode transceiver status for a-session valid.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 353 www.energymicro.com bit name reset access description 17 dbnctime 0 r long/short debounce time (host only) indicates the debounce time of a detected connection. value mode description 0 long long debounce time, used for physical connections (100 ms + 2.5 us). 1 short short debounce time, used for soft connections (2.5 us). 16 conidsts 1 r connector id status (host and device) indicates the connector id status on a connect event. value mode description 0 a the core is in a-device mode. 1 b the core is in b-device mode. 15:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 devhnpen 0 rw device hnp enabled (device only) the application sets this bit when it successfully receives a setfeature.sethnpenable command from the connected usb host. 10 hstsethnpen 0 rw host set hnp enable (host only) the application sets this bit when it has successfully enabled hnp (using the setfeature.sethnpenable command) on the connected device. 9 hnpreq 0 rw hnp request (device only) the application sets this bit to initiate an hnp request to the connected usb host. the application can clear this bit by writing a 0 when the host negotiation success status change bit in the otg interrupt register (usb_gotgint.hstnegsucstschng) is set. the core clears this bit when the hstnegsucstschng bit is cleared. 8 hstnegscs 0 r host negotiation success (device only) the core sets this bit when host negotiation is successful. the core clears this bit when the hnp request (hnpreq) bit in this register is set. 7 avalidovval 0 rw avalid override value this bit is used to set override value for avalid signal when usb_gotgctl.avalidoven is set. 6 avalidoven 0 rw avalid override enable this bit is used to enable/disable the software to override the avalid signal using the usb_gotgctl.avalidovval. when set avalid received from the phy is overridden with usb_gotgctl.avalidovval. 5 bvalidovval 0 rw bvalid override value this bit is used to set override value for bvalid signal when usb_gotgctl.bvalidoven is set. 4 bvalidoven 0 rw bvalid override enable this bit is used to enable/disable the software to override the bvalid signal using the usb_gotgctl.bvalidovval. when set bvalid received from the phy is overridden with usb_gotgctl.bvalidovval. 3 vbvalidovval 0 rw vbus valid override value this bit is used to set override value for vbusvalid signal when usb_gotgctl.vbvalidoven is set. 2 vbvalidoven 0 rw vbus-valid override enable this bit is used to enable/disable the software to override the vbusvalid signal using the usb_gotgctl.vbvalidovval. when set, vbusvalid received from the phy is overridden with usb_gotgctl.vbvalidovval. 1 sesreq 0 rw session request (device only) the application sets this bit to initiate a session request on the usb. the application can clear this bit by writing a 0 when the host negotiation success status change bit in the otg interrupt register (usb_gotgint.hstnegsucstschng) is set. the core clears this bit when the hstnegsucstschng bit is cleared. the application must wait until the vbus discharges to 0.2 v, after the b-session valid bit in this register (usb_gotgctl.bsesvld) is cleared. this discharge time can be obtained from the datasheet. 0 sesreqscs 0 r session request success (device only) the core sets this bit when a session request initiation is successful. 15.6.9 usb_gotgint - otg interrupt register the application reads this register whenever there is an otg interrupt and clears the bits in this register to clear the otg interrupt.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 354 www.energymicro.com offset bit position 0x3c004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw1 rw1 rw1 rw1 rw1 rw1 name dbncedone adevtoutchg hstnegdet hstnegsucstschng sesreqsucstschng sesenddet bit name reset access description 31:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19 dbncedone 0 rw1 debounce done (host only) the core sets this bit when the debounce is completed after the device connect. the application can start driving usb reset after seeing this interrupt. this bit is only valid when the hnp capable or srp capable bit is set in the core usb configuration register (usb_gusbcfg.hnpcap or usb_gusbcfg.srpcap, respectively). this bit can be set only by the core and the application should write 1 to clear it. 18 adevtoutchg 0 rw1 a-device timeout change (host and device) the core sets this bit to indicate that the a-device has timed out while waiting for the b-device to connect. this bit can be set only by the core and the application should write 1 to clear it. 17 hstnegdet 0 rw1 host negotiation detected (host and device) the core sets this bit when it detects a host negotiation request on the usb. this bit can be set only by the core and the application should write 1 to clear it. 16:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9 hstnegsucstschng 0 rw1 host negotiation success status change (host and device) the core sets this bit on the success or failure of a usb host negotiation request. the application must read the host negotiation success bit of the otg control and status register (usb_gotgctl.hstnegscs) to check for success or failure. this bit can be set only by the core and the application should write 1 to clear it. 8 sesreqsucstschng 0 rw1 session request success status change (host and device) the core sets this bit on the success or failure of a session request. the application must read the session request success bit in the otg control and status register (usb_gotgctl.sesreqscs) to check for success or failure. this bit can be set only by the core and the application should write 1 to clear it. 7:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 sesenddet 0 rw1 session end detected (host and device) the core sets this bit when vbus is in the range 0.8v - 2.0v. this bit can be set only by the core and the application should write 1 to clear it. 1:0 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15.6.10 usb_gahbcfg - ahb configuration register this register can be used to configure the core after power-on or a change in mode. this register mainly contains ahb system-related configuration parameters. do not change this register after the initial programming. the application must program this register before starting any transactions on either the ahb or the usb.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 355 www.energymicro.com offset bit position 0x3c008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0x0 0 access rw rw rw rw rw rw rw name notialldmawrit remmemsupp ptxfemplvl nptxfemplvl dmaen hbstlen glblintrmsk bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 notialldmawrit 0 rw notify all dma writes this bit is programmed to enable the system dma done functionality for all the dma write transactions corresponding to the channel/ endpoint. this bit is valid only when usb_gahbcfg.remmemsupp is set to 1. when set, the core asserts int_dma_req for all the dma write transactions on the ahb interface along with int_dma_done, chep_last_transact and chep_number signal informations. the core waits for sys_dma_done signal for all the dma write transactions in order to complete the transfer of a particular channel/ endpoint. when cleared, the core asserts int_dma_req signal only for the last transaction of dma write transfer corresponding to a particular channel/endpoint. similarly, the core waits for sys_dma_done signal only for that transaction of dma write to complete the transfer of a particular channel/endpoint. 21 remmemsupp 0 rw remote memory support this bit is programmed to enable the functionality to wait for the system dma done signal for the dma write transfers. when set, the int_dma_req output signal is asserted when hsotg dma starts write transfer to the external memory. when the core is done with the transfers it asserts int_dma_done signal to flag the completion of dma writes from hsotg. the core then waits for sys_dma_done signal from the system to proceed further and complete the data transfer corresponding to a particular channel/endpoint. when cleared, the int_dma_req and int_dma_done signals are not asserted and the core proceeds with the assertion of the xfercomp interrupt as soon as the dma write transfer is done at the hsotg core boundary and it doesn't wait for the sys_dma_done signal to complete the data. 20:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 ptxfemplvl 0 rw periodic txfifo empty level (host only) indicates when the periodic txfifo empty interrupt bit in the core interrupt register (usb_gintsts.ptxfemp) is triggered. this bit is used only in slave mode. value mode description 0 halfempty usb_gintsts.ptxfemp interrupt indicates that the periodic txfifo is half empty. 1 empty usb_gintsts.ptxfemp interrupt indicates that the periodic txfifo is completely empty. 7 nptxfemplvl 0 rw non-periodic txfifo empty level (host and device) this bit is used only in slave mode. in host mode this bit indicates when the non-periodic txfifo empty interrupt bit in the core interrupt register (usb_gintsts.nptxfemp) is triggered. in device mode, this bit indicates when in endpoint transmit fifo empty interrupt (usb_diep0int/usb_diepx_int.txfemp) is triggered. value mode description 0 halfempty host mode: usb_gintsts.nptxfemp interrupt indicates that the non-periodic txfifo is half empty. device mode: usb_diep0int/usb_diepx_int.txfemp interrupt indicates that the in endpoint txfifo is half empty. 1 empty host mode: usb_gintsts.nptxfemp interrupt indicates that the non-periodic txfifo is completely empty. device mode: usb_diep0int/usb_diepx_int.txfemp interrupt indicates that the in endpoint txfifo is completely empty. 6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 dmaen 0 rw dma enable (host and device) when set to 0 the core operates in slave mode. when set to 1 the core operates in a dma mode. 4:1 hbstlen 0x0 rw burst length/type (host and device) this field is used in dma mode.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 356 www.energymicro.com bit name reset access description value mode description 0 single single transfer. 1 incr incrementing burst of unspecified length. 3 incr4 4-beat incrementing burst. 5 incr8 8-beat incrementing burst. 7 incr16 16-beat incrementing burst. 0 glblintrmsk 0 rw global interrupt mask (host and device) the application uses this bit to mask or unmask the interrupt line assertion to itself. irrespective of this bit's setting, the interrupt status registers are updated by the core. set to unmask. 15.6.11 usb_gusbcfg - usb configuration register this register can be used to configure the core after power-on or a changing to host mode or device mode. it contains usb and usb-phy related configuration parameters. the application must program this register before starting any transactions on either the ahb or the usb. do not make changes to this register after the initial programming. offset bit position 0x3c00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0x5 0 0 0 0x0 access w1 rw rw rw rw rw rw rw rw rw name corrupttxpkt forcedevmode forcehstmode txenddelay termseldlpulse usbtrdtim hnpcap srpcap fsintf toutcal bit name reset access description 31 corrupttxpkt 0 w1 corrupt tx packet (host and device) this bit is for debug purposes only. never set this bit to 1. the application should always write 0 to this bit. 30 forcedevmode 0 rw force device mode (host and device) writing a 1 to this bit forces the core to device mode irrespective of the state of the id pin. after setting the force bit, the application must wait at least 25 ms before the change to take effect. 29 forcehstmode 0 rw force host mode (host and device) writing a 1 to this bit forces the core to host mode irrespective of the state of the id pin. after setting the force bit, the application must wait at least 65 ms before the change to take effect. 28 txenddelay 0 rw tx end delay (device only) writing 1 to this bit enables the core to follow the txenddelay timings as per utmi+ specification 1.05 section 4.1.5 for opmode signal during remote wakeup. 27:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 termseldlpulse 0 rw termsel dline pulsing selection (device only) this bit selects utmi_termselect to drive data line pulse during srp. value mode description 0 txvalid data line pulsing using utmi_txvalid. 1 termsel data line pulsing using utmi_termsel. 21:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:10 usbtrdtim 0x5 rw usb turnaround time (device only) sets the turnaround time in phy clocks. specifies the response time for a mac request to the packet fifo controller (pfc) to fetch data from the dfifo (spram). always write this field to 5.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 357 www.energymicro.com bit name reset access description 9 hnpcap 0 rw hnp-capable (host and device) the application uses this bit to control the core's hnp capabilities. set to enable hnp capability. 8 srpcap 0 rw srp-capable (host and device) the application uses this bit to control the core's srp capabilities. if the core operates as a non-srp-capable b-device, it cannot request the connected a-device (host) to activate vbus and start a session. set to enable srp capability. 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 fsintf 0 rw full-speed serial interface select (host and device) always write this bit to 0. 4:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2:0 toutcal 0x0 rw timeout calibration (host and device) always write this field to 0. 15.6.12 usb_grstctl - reset register the application uses this register to reset various hardware features inside the core. offset bit position 0x3c010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 0 0x00 0 0 0 0 access r r rw rw1 rw1 rw1 rw1 name ahbidle dmareq txfnum txfflsh rxfflsh frmcntrrst csftrst bit name reset access description 31 ahbidle 1 r ahb master idle (host and device) indicates that the ahb master state machine is in the idle condition. 30 dmareq 0 r dma request signal (host and device) indicates that the dma request is in progress. used for debug. 29:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:6 txfnum 0x00 rw txfifo number (host and device) this is the fifo number that must be flushed using the txfifo flush bit. this field must not be changed until the core clears the txfifo flush bit. value mode description 0 f0 host mode: non-periodic txfifo flush. device: tx fifo 0 flush 1 f1 host mode: periodic txfifo flush. device: txfifo 1 flush. 2 f2 device mode: txfifo 2 flush. 3 f3 device mode: txfifo 3 flush. 4 f4 device mode: txfifo 4 flush. 5 f5 device mode: txfifo 5 flush. 6 f6 device mode: txfifo 6 flush. 16 fall flush all the transmit fifos in device or host mode. 5 txfflsh 0 rw1 txfifo flush (host and device) this bit selectively flushes a single or all transmit fifos, but cannot do so if the core is in the midst of a transaction. the application must write this bit only after checking that the core is neither writing to the txfifo nor reading from the txfifo. nak effective
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 358 www.energymicro.com bit name reset access description interrupt ensures the core is not reading from the fifo. usb_grstctl.ahbidle ensures the core is not writing anything to the fifo. flushing is normally recommended when fifos are reconfigured. fifo flushing is also recommended during device endpoint disable. the application must wait until the core clears this bit before performing any operations. this bit takes eight clocks to clear. 4 rxfflsh 0 rw1 rxfifo flush (host and device) the application can flush the entire rxfifo using this bit, but must first ensure that the core is not in the middle of a transaction. the application must only write to this bit after checking that the core is neither reading from the rxfifo nor writing to the rxfifo. the application must wait until the bit is cleared before performing any other operations. this bit requires 8 clocks to clear. 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 frmcntrrst 0 rw1 host frame counter reset (host only) the application writes this bit to reset the frame number counter inside the core. when the frame counter is reset, the subsequent sof sent out by the core has a frame number of 0. when application writes 1 to the bit, it might not be able to read back the value as it will get cleared by the core in a few clock cycles. 1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 csftrst 0 rw1 core soft reset (host and device) resets the core by clearing the interrupts and all the csr registers except the following register bits: usb_pcgcctl.rstpdwnmodule, usb_pcgcctl.gatehclk, usb_pcgcctl.pwrclmp, usb_gusbcfg.fsintf, usb_hcfg.fslspclksel, usb_dcfg.devspd. all module state machines (except the ahb slave unit) are reset to the idle state, and all the transmit fifos and the receive fifo are flushed. any transactions on the ahb master are terminated as soon as possible, after gracefully completing the last data phase of an ahb transfer. any transactions on the usb are terminated immediately. the application can write to this bit any time it wants to reset the core. this is a self-clearing bit and the core clears this bit after all the necessary logic is reset in the core, which can take several clocks, depending on the current state of the core. once this bit is cleared software must wait at least 3 clock cycles before doing any access to the core. software must also must check that bit 31 of this register is 1 (ahb master is idle) before starting any operation. 15.6.13 usb_gintsts - interrupt register this register interrupts the application for system-level events in the current mode (device mode or host mode). some of the bits in this register are valid only in host mode, while others are valid in device mode only. this register also indicates the current mode. to clear the interrupt status bits of type rw1, the application must write 1 into the bit. the fifo status interrupts are read only; once software reads from or writes to the fifo while servicing these interrupts, fifo interrupt conditions are cleared automatically. the application must clear the usb_gintsts register at initialization before unmasking the interrupt bit to avoid any interrupts generated prior to initialization. offset bit position 0x3c014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 access rw1 rw1 rw1 rw1 r r r rw1 rw1 rw1 rw1 r r rw1 rw1 rw1 rw1 rw1 r r r r rw1 r rw1 r name wkupint sessreqint disconnint conidstschng ptxfemp hchint prtint resetdet fetsusp incomplp incompisoin oepint iepint isooutdrop enumdone usbrst usbsusp erlysusp goutnakeff ginnakeff nptxfemp rxflvl sof otgint modemis curmod bit name reset access description 31 wkupint 0 rw1 resume/remote wakeup detected interrupt (host and device) wakeup interrupt during suspend state. in device mode this interrupt is asserted only when host initiated resume is detected on usb. in host mode this interrupt is asserted only when device initiated remote wakeup is detected on usb. this bit can be set only by the core and the application should write 1 to clear. 30 sessreqint 0 rw1 session request/new session detected interrupt (host and device)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 359 www.energymicro.com bit name reset access description in host mode, this interrupt is asserted when a session request is detected from the device. in device mode, this interrupt is asserted when the vbus voltage reaches the session-valid level. this bit can be set only by the core and the application should write 1 to clear. 29 disconnint 0 rw1 disconnect detected interrupt (host only) asserted when a device disconnect is detected. this bit can be set only by the core and the application should write 1 to clear it. 28 conidstschng 1 rw1 connector id status change (host and device) the core sets this bit when there is a change in connector id status. this bit can be set only by the core and the application should write 1 to clear it. 27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26 ptxfemp 1 r periodic txfifo empty (host only) this interrupt is asserted when the periodic transmit fifo is either half or completely empty and there is space for at least one entry to be written in the periodic request queue. the half or completely empty status is determined by the periodic txfifo empty level bit in the core ahb configuration register (usb_gahbcfg.ptxfemplvl). 25 hchint 0 r host channels interrupt (host only) the core sets this bit to indicate that an interrupt is pending on one of the channels of the core (in host mode). the application must read the host all channels interrupt (usb_haint) register to determine the exact number of the channel on which the interrupt occurred, and then read the corresponding host channel-x interrupt (usb_hcx_int) register to determine the exact cause of the interrupt. the application must clear the appropriate status bit in the usb_hcx_int register to clear this bit. 24 prtint 0 r host port interrupt (host only) the core sets this bit to indicate a change in port status in host mode. the application must read the host port control and status (usb_hprt) register to determine the exact event that caused this interrupt. the application must clear the appropriate status bit in the host port control and status register to clear this bit. 23 resetdet 0 rw1 reset detected interrupt (device only) in device mode, this interrupt is asserted when a reset is detected on the usb in em2 when the device is in suspend. in host mode, this interrupt is not asserted. 22 fetsusp 0 rw1 data fetch suspended (device only) this interrupt is valid only in dma mode. this interrupt indicates that the core has stopped fetching data for in endpoints due to the unavailability of txfifo space or request queue space. this interrupt is used by the application for an endpoint mismatch algorithm. for example, after detecting an endpoint mismatch, the application: sets a global non-periodic in nak handshake, disables in endpoints, flushes the fifo, determines the token sequence from the in token sequence, re-enables the endpoints, clears the global non-periodic in nak handshake. if the global non-periodic in nak is cleared, the core has not yet fetched data for the in endpoint, and the in token is received: the core generates an in token received when fifo empty interrupt. the otg then sends the host a nak response. to avoid this scenario, the application can check the usb_gintsts.fetsusp interrupt, which ensures that the fifo is full before clearing a global nak handshake. alternatively, the application can mask the in token received when fifo empty interrupt when clearing a global in nak handshake. 21 incomplp 0 rw1 incomplete periodic transfer (device only) in host mode, the core sets this interrupt bit when there are incomplete periodic transactions still pending which are scheduled for the current frame. in device mode, the core sets this interrupt to indicate that there is at least one isochronous out endpoint on which the transfer is not completed in the current frame. this bit can be set only by the core and the application should write 1 to clear it. 20 incompisoin 0 rw1 incomplete isochronous in transfer (device only) the core sets this interrupt to indicate that there is at least one isochronous in endpoint on which the transfer is not completed in the current frame. 19 oepint 0 r out endpoints interrupt (device only) the core sets this bit to indicate that an interrupt is pending on one of the out endpoints of the core (in device mode). the application must read the device all endpoints interrupt (usb_daint) register to determine the exact number of the out endpoint on which the interrupt occurred, and then read the corresponding device out endpoint-x interrupt (usb_doep0int/usb_doepx_int) register to determine the exact cause of the interrupt. the application must clear the appropriate status bit in the corresponding usb_doep0int/usb_doepx_int register to clear this bit. 18 iepint 0 r in endpoints interrupt (device only) the core sets this bit to indicate that an interrupt is pending on one of the in endpoints of the core (in device mode). the application must read the device all endpoints interrupt (usb_daint) register to determine the exact number of the in endpoint on device in endpoint-x interrupt (usb_diep0int/usb_diepx_int) register to determine the exact cause of the interrupt. the application must clear the appropriate status bit in the corresponding usb_diep0int/usb_diepx_int register to clear this bit. 17:15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14 isooutdrop 0 rw1 isochronous out packet dropped interrupt (device only)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 360 www.energymicro.com bit name reset access description the core sets this bit when it fails to write an isochronous out packet into the rxfifo because the rxfifo does not have enough space to accommodate a maximum packet size packet for the isochronous out endpoint. 13 enumdone 0 rw1 enumeration done (device only) the core sets this bit to indicate that speed enumeration is complete. the application must read the device status (usb_dsts) register to obtain the enumerated speed. 12 usbrst 0 rw1 usb reset (device only) the core sets this bit to indicate that a reset is detected on the usb. 11 usbsusp 0 rw1 usb suspend (device only) the core sets this bit to indicate that a suspend was detected on the usb. the core enters the suspended state when there is no activity on the bus for an extended period of time. 10 erlysusp 0 rw1 early suspend (device only) the core sets this bit to indicate that an idle state has been detected on the usb for 3 ms. 9:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 goutnakeff 0 r global out nak effective (device only) indicates that the set global out nak bit in the device control register (usb_dctl.sgoutnak), set by the application, has taken effect in the core. this bit can be cleared by writing the clear global out nak bit in the device control register (usb_dctl.cgoutnak). 6 ginnakeff 0 r global in non-periodic nak effective (device only) indicates that the set global non-periodic in nak bit in the device control register (usb_dctl.sgnpinnak), set by the application, has taken effect in the core. that is, the core has sampled the global in nak bit set by the application. this bit can be cleared by clearing the clear global non-periodic in nak bit in the device control register (usb_dctl.cgnpinnak). this interrupt does not necessarily mean that a nak handshake is sent out on the usb. the stall bit takes precedence over the nak bit. 5 nptxfemp 1 r non-periodic txfifo empty (host only) this interrupt is asserted when the non-periodic txfifo is either half or completely empty, and there is space for at least one entry to be written to the non-periodic transmit request queue. the half or completely empty status is determined by the non-periodic txfifo empty level bit in the core ahb configuration register (usb_gahbcfg.nptxfemplvl). 4 rxflvl 0 r rxfifo non-empty (host and device) indicates that there is at least one packet pending to be read from the rxfifo. 3 sof 0 rw1 start of frame (host and device) in host mode, the core sets this bit to indicate that an sof (fs) or keep-alive (ls) is transmitted on the usb. the application must write a 1 to this bit to clear the interrupt. in device mode, in the core sets this bit to indicate that an sof token has been received on the usb. the application can read the device status register to get the current frame number. this interrupt is seen only when the core is operating at full-speed (fs). this bit can be set only by the core and the application should write 1 to clear it. 2 otgint 0 r otg interrupt (host and device) the core sets this bit to indicate an otg protocol event. the application must read the otg interrupt status (usb_gotgint) register to determine the exact event that caused this interrupt. the application must clear the appropriate status bit in the usb_gotgint register to clear this bit. 1 modemis 0 rw1 mode mismatch interrupt (host and device) the core sets this bit when the application is trying to access a host mode register, when the core is operating in device mode or when the application accesses a device mode register, when the core is operating in host mode. the register access is ignored by the core internally and does not affect the operation of the core. this bit can be set only by the core and the application should write 1 to clear it. 0 curmod 0 r current mode of operation (host and device) indicates the current mode. value mode description 0 device device mode. 1 host host mode. 15.6.14 usb_gintmsk - interrupt mask register this register works with the interrupt register (usb_gintsts) to interrupt the application. when an interrupt bit is masked (bit is 0), the interrupt associated with that bit is not generated. however, the usb_gintsts register bit corresponding to that interrupt is still set.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 361 www.energymicro.com offset bit position 0x3c018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name wkupintmsk sessreqintmsk disconnintmsk conidstschngmsk ptxfempmsk hchintmsk prtintmsk resetdetmsk fetsuspmsk incomplpmsk incompisoinmsk oepintmsk iepintmsk isooutdropmsk enumdonemsk usbrstmsk usbsuspmsk erlysuspmsk goutnakeffmsk ginnakeffmsk nptxfempmsk rxflvlmsk sofmsk otgintmsk modemismsk bit name reset access description 31 wkupintmsk 0 rw resume/remote wakeup detected interrupt mask (host and device) set to 1 to unmask wkupint interrupt. 30 sessreqintmsk 0 rw session request/new session detected interrupt mask (host and device) set to 1 to unmask sessreqint interrupt. 29 disconnintmsk 0 rw disconnect detected interrupt mask (host and device) set to 1 to unmask disconnint interrupt. 28 conidstschngmsk 0 rw connector id status change mask (host and device) set to 1 to unmask conidstschng interrupt. 27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26 ptxfempmsk 0 rw periodic txfifo empty mask (host only) set to 1 to unmask ptxfemp interrupt. 25 hchintmsk 0 rw host channels interrupt mask (host only) set to 1 to unmask hchint interrupt. 24 prtintmsk 0 rw host port interrupt mask (host only) set to 1 to unmask prtint interrupt. 23 resetdetmsk 0 rw reset detected interrupt mask (device only) set to 1 to unmask resetdet interrupt. 22 fetsuspmsk 0 rw data fetch suspended mask (device only) set to 1 to unmask fetsusp interrupt. 21 incomplpmsk 0 rw incomplete periodic transfer mask (host only) set to 1 to unmask incomplp interrupt. 20 incompisoinmsk 0 rw incomplete isochronous in transfer mask (device only) set to 1 to unmask incompisoin interrupt. 19 oepintmsk 0 rw out endpoints interrupt mask (device only) set to 1 to unmask oepint interrupt. 18 iepintmsk 0 rw in endpoints interrupt mask (device only) set to 1 to unmask iepint interrupt. 17:15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14 isooutdropmsk 0 rw isochronous out packet dropped interrupt mask (device only) set to 1 to unmask isooutdrop interrupt. 13 enumdonemsk 0 rw enumeration done mask (device only) set to 1 to unmask enumdone interrupt. 12 usbrstmsk 0 rw usb reset mask (device only)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 362 www.energymicro.com bit name reset access description set to 1 to unmask usbrst interrupt. 11 usbsuspmsk 0 rw usb suspend mask (device only) set to 1 to unmask usbsusp interrupt. 10 erlysuspmsk 0 rw early suspend mask (device only) set to 1 to unmask erlysusp interrupt. 9:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 goutnakeffmsk 0 rw global out nak effective mask (device only) set to 1 to unmask goutnakeff interrupt. 6 ginnakeffmsk 0 rw global non-periodic in nak effective mask (device only) set to 1 to unmask ginnakeff interrupt. 5 nptxfempmsk 0 rw non-periodic txfifo empty mask (host only) set to 1 to unmask nptxfemp interrupt. 4 rxflvlmsk 0 rw receive fifo non-empty mask (host and device) set to 1 to unmask rxflvl interrupt. 3 sofmsk 0 rw start of frame mask (host and device) set to 1 to unmask sof interrupt. 2 otgintmsk 0 rw otg interrupt mask (host and device) set to 1 to unmask otgint interrupt. 1 modemismsk 0 rw mode mismatch interrupt mask (host and device) set to 1 to unmask modemis interrupt. 0 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15.6.15 usb_grxstsr - receive status debug read register a read to the receive status debug read register returns the contents of the top of the receive fifo. the receive status contents must be interpreted differently in host and device modes. the core ignores the receive status pop/read when the receive fifo is empty and returns a value of 0x00000000. the application must only pop the receive status fifo when the receive fifo non-empty bit of the core interrupt register (usb_gintsts.rxflvl) is asserted. offset bit position 0x3c01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0x000 0x0 access r r r r r name fn pktsts dpid bcnt chepnum bit name reset access description 31:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27:24 fn 0x0 r frame number (device only) this is the least significant 4 bits of the frame number in which the packet is received on the usb. 23:21 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 20:17 pktsts 0x0 r packet status (host or device) indicates the status of the received packet.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 363 www.energymicro.com bit name reset access description value mode description 1 goutnak device mode: global out nak (triggers an interrupt). 2 pktrcv host mode: in data packet received. device mode: out data packet received. 3 xfercompl host mode: in transfer completed (triggers an interrupt). device mode: out transfer completed (triggers an interrupt). 4 setupcompl device mode: setup transaction completed (triggers an interrupt). 5 tglerr host mode: data toggle error (triggers an interrupt). 6 setuprcv device mode: setup data packet received. 7 chlt host mode: channel halted (triggers an interrupt). 16:15 dpid 0x0 r data pid (host or device) host mode: indicates the data pid of the received packet. device mode: indicates the data pid of the received out data packet. value mode description 0 data0 data0 pid. 1 data1 data1 pid. 2 data2 data2 pid. 3 mdata mdata pid. 14:4 bcnt 0x000 r byte count (host or device) host mode: indicates the byte count of the received in data packet. device mode: indicates the byte count of the received data packet. 3:0 chepnum 0x0 r channel number (host only) / endpoint number (device only) host mode: indicates the channel number to which the current received packet belongs. device mode: indicates the endpoint number to which the current received packet belongs. 15.6.16 usb_grxstsp - receive status read and pop register a read to the receive status read and pop register returns the contents of the top of the receive fifo and pops the top data entry out of the rxfifo. the receive status contents must be interpreted differently in host and device modes. the core ignores the receive status pop/read when the receive fifo is empty and returns a value of 0x00000000. the application must only pop the receive status fifo when the receive fifo non-empty bit of the core interrupt register (usb_gintsts.rxflvl) is asserted. offset bit position 0x3c020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0x000 0x0 access r r r r r name fn pktsts dpid bcnt chepnum bit name reset access description 31:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24:21 fn 0x0 r frame number (device only) this is the least significant 4 bits of the frame number in which the packet is received on the usb. 20:17 pktsts 0x0 r packet status (host or device) indicates the status of the received packet.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 364 www.energymicro.com bit name reset access description value mode description 1 goutnak device mode: global out nak (triggers an interrupt). 2 pktrcv host mode: in data packet received. device mode: out data packet received. 3 xfercompl host mode: in transfer completed (triggers an interrupt). device mode: out transfer completed (triggers an interrupt). 4 setupcompl device mode: setup transaction completed (triggers an interrupt). 5 tglerr host mode: data toggle error (triggers an interrupt). 6 setuprcv device mode: setup data packet received. 7 chlt host mode: channel halted (triggers an interrupt). 16:15 dpid 0x0 r data pid (host or device) host mode: indicates the data pid of the received packet. device mode: indicates the data pid of the received out data packet. value mode description 0 data0 data0 pid. 1 data1 data1 pid. 2 data2 data2 pid. 3 mdata mdata pid. 14:4 bcnt 0x000 r byte count (host or device) host mode: indicates the byte count of the received in data packet. device mode: indicates the byte count of the received data packet. 3:0 chepnum 0x0 r channel number (host only) / endpoint number (device only) host mode: indicates the channel number to which the current received packet belongs. device mode: indicates the endpoint number to which the current received packet belongs. 15.6.17 usb_grxfsiz - receive fifo size register the application can program the ram size that must be allocated to the rxfifo. offset bit position 0x3c024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x200 access rw name rxfdep bit name reset access description 31:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:0 rxfdep 0x200 rw rxfifo depth this value is in terms of 32-bit words. minimum value is 16. maximum value is 512. 15.6.18 usb_gnptxfsiz - non-periodic transmit fifo size register the application can program the ram size and the memory start address for the non-periodic txfifo.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 365 www.energymicro.com offset bit position 0x3c028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0200 0x200 access rw rw name nptxfineptxf0dep nptxfstaddr bit name reset access description 31:16 nptxfineptxf0dep 0x0200 rw non-periodic txfifo depth (host only) / in endpoint txfifo 0 depth (device only) this value is in terms of 32-bit words. minimum value is 16. maximum value is 512. 15:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:0 nptxfstaddr 0x200 rw non-periodic transmit ram start address (host only) this field contains the memory start address for non-periodic transmit fifo ram. programmed values must not exceed the reset value. 15.6.19 usb_gnptxsts - non-periodic transmit fifo/queue status register this register is used in host mode only. this read-only register contains the free space information for the non-periodic txfifo and the nonperiodic transmit request queue. offset bit position 0x3c02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x08 0x0200 access r r r name nptxqtop nptxqspcavail nptxfspcavail bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:24 nptxqtop 0x00 r top of the non-periodic transmit request queue entry in the non-periodic tx request queue that is currently being processed by the mac. bits [6:3]: channel/endpoint number. bits [2:1]: 00: in/out token, 01: zero-length transmit packet (device in/host out), 10: unused, 11: channel halt command. bit [0]: terminate (last entry for selected channel/endpoint). 23:16 nptxqspcavail 0x08 r non-periodic transmit request queue space available
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 366 www.energymicro.com bit name reset access description indicates the amount of free space (locations) available in the non-periodic transmit request queue. this queue holds both in and out requests in host mode. device mode has only in requests. 15:0 nptxfspcavail 0x0200 r non-periodic txfifo space available indicates the amount of free space available in the non-periodic txfifo. values are in terms of 32-bit words. 15.6.20 usb_gdfifocfg - global dfifo configuration register offset bit position 0x3c05c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x01f2 0x0200 access rw rw name epinfobaseaddr gdfifocfg bit name reset access description 31:16 epinfobaseaddr 0x01f2 rw endpoint info base address this field provides the start address of the ep info controller. 15:0 gdfifocfg 0x0200 rw dfifo config this field is for dynamic programming of the dfifo size. this value takes effect only when the application programs a non zero value to this register. the core does not have any corrective logic if the fifo sizes are programmed incorrectly. 15.6.21 usb_hptxfsiz - host periodic transmit fifo size register this register holds the size and the memory start address of the periodic txfifo. offset bit position 0x3c100 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x200 0x400 access rw rw name ptxfsize ptxfstaddr bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:16 ptxfsize 0x200 rw host periodic txfifo depth this value is in terms of 32-bit words. minimum value is 16. maximum value is 512. 15:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:0 ptxfstaddr 0x400 rw host periodic txfifo start address this field contains the memory start address for host periodic txfifo.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 367 www.energymicro.com 15.6.22 usb_dieptxf1 - device in endpoint transmit fifo 1 size register this register holds the size and memory start address of in endpoint txfifo 1 in device mode. for in endpoint fifo 0 use usb_gnptxfsiz register for programming the size and memory start address. offset bit position 0x3c104 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x200 0x400 access rw rw name inepntxfdep inepntxfstaddr bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:16 inepntxfdep 0x200 rw in endpoint txfifo depth this value is in terms of 32-bit words. minimum value is 16. maximum value is 512. 15:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:0 inepntxfstaddr 0x400 rw in endpoint fifo 1 transmit ram start address this field contains the memory start address for in endpoint transmit fifo 1. 15.6.23 usb_dieptxf2 - device in endpoint transmit fifo 2 size register this register holds the size and memory start address of in endpoint txfifo 2 in device mode. for in endpoint fifo 0 use usb_gnptxfsiz register for programming the size and memory start address. offset bit position 0x3c108 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x200 0x600 access rw rw name inepntxfdep inepntxfstaddr bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:16 inepntxfdep 0x200 rw in endpoint txfifo depth this value is in terms of 32-bit words. minimum value is 16. maximum value is 512. 15:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:0 inepntxfstaddr 0x600 rw in endpoint fifo 2 transmit ram start address this field contains the memory start address for in endpoint transmit fifo 2.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 368 www.energymicro.com 15.6.24 usb_dieptxf3 - device in endpoint transmit fifo 3 size register this register holds the size and memory start address of in endpoint txfifo 3 in device mode. for in endpoint fifo 0 use usb_gnptxfsiz register for programming the size and memory start address. offset bit position 0x3c10c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x200 0x800 access rw rw name inepntxfdep inepntxfstaddr bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:16 inepntxfdep 0x200 rw in endpoint txfifo depth this value is in terms of 32-bit words. minimum value is 16. maximum value is 512. 15:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:0 inepntxfstaddr 0x800 rw in endpoint fifo 3 transmit ram start address this field contains the memory start address for in endpoint transmit fifo 3. 15.6.25 usb_dieptxf4 - device in endpoint transmit fifo 4 size register this register holds the size and memory start address of in endpoint txfifo 4 in device mode. for in endpoint fifo 0 use usb_gnptxfsiz register for programming the size and memory start address. offset bit position 0x3c110 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x200 0xa00 access rw rw name inepntxfdep inepntxfstaddr bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:16 inepntxfdep 0x200 rw in endpoint txfifo depth this value is in terms of 32-bit words. minimum value is 16. maximum value is 512. 15:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:0 inepntxfstaddr 0xa00 rw in endpoint fifo 4 transmit ram start address
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 369 www.energymicro.com bit name reset access description this field contains the memory start address for in endpoint transmit fifo 4. 15.6.26 usb_dieptxf5 - device in endpoint transmit fifo 5 size register this register holds the size and memory start address of in endpoint txfifo 5 in device mode. for in endpoint fifo 0 use usb_gnptxfsiz register for programming the size and memory start address. offset bit position 0x3c114 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x200 0xc00 access rw rw name inepntxfdep inepntxfstaddr bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:16 inepntxfdep 0x200 rw in endpoint txfifo depth this value is in terms of 32-bit words. minimum value is 16. maximum value is 512. 15:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:0 inepntxfstaddr 0xc00 rw in endpoint fifo 5 transmit ram start address this field contains the memory start address for in endpoint transmit fifo 5. 15.6.27 usb_dieptxf6 - device in endpoint transmit fifo 6 size register this register holds the size and memory start address of in endpoint txfifo 6 in device mode. for in endpoint fifo 0 use usb_gnptxfsiz register for programming the size and memory start address. offset bit position 0x3c118 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x200 0xe00 access rw rw name inepntxfdep inepntxfstaddr bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:16 inepntxfdep 0x200 rw in endpoint txfifo depth this value is in terms of 32-bit words. minimum value is 16. maximum value is 512.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 370 www.energymicro.com bit name reset access description 15:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:0 inepntxfstaddr 0xe00 rw in endpoint fifo 6 transmit ram start address this field contains the memory start address for in endpoint transmit fifo 6. 15.6.28 usb_hcfg - host configuration register this register configures the core after power-on. do not make changes to this register after initializing the host. offset bit position 0x3c400 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x00 0 0 0x0 access rw rw rw rw rw name modechtimen resvalid ena32khzs fslssupp fslspclksel bit name reset access description 31 modechtimen 0 rw mode change time this bit is used to enable/disable the host core to wait 200 clock cycles at the end of resume before changing the phy opmode to normal operation. when set to 0 the host core waits for either 200 phy clock cycles or a linestate of se0 at the end of resume to the change the phy opmode to normal operation. when set to 1 the host core waits only for a linstate of se0 at the end of resume to change the phy opmode to normal operation. 30:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:8 resvalid 0x00 rw resume validation period this field is effective only when usb_hcfg.ena32khzs is set. it will control the resume period when the core resumes from suspend. the core counts for resvalid number of clock cycles to detect a valid resume when usb_hcfg.ena32khzs is set. 7 ena32khzs 0 rw enable 32 khz suspend mode when this bit is set the core expects that the clock to the core during suspend is switched from 48 mhz to 32 khz. 6:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 fslssupp 0 rw fs- and ls-only support the application uses this bit to control the core's enumeration speed. using this bit, the application can make the core enumerate as a fs host, even if the connected device supports hs traffic. do not make changes to this field after initial programming. value mode description 0 hsfsls hs/fs/ls, based on the maximum speed supported by the connected device. 1 fsls fs/ls-only, even if the connected device can support hs. 1:0 fslspclksel 0x0 rw fs/ls phy clock select use this field to set the internal phy clock frequency. set to 48 mhz in fs host mode and 6 mhz in ls host mode. when you select a 6 mhz clock during ls mode, you must do a soft reset. value mode description 1 div1 internal phy clock is running at 48 mhz (undivided). 2 div8 internal phy clock is running at 6 mhz (48 mhz divided by 8). 15.6.29 usb_hfir - host frame interval register this register stores the frame interval information for the current speed to which the core has enumerated.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 371 www.energymicro.com offset bit position 0x3c404 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x17d7 access rw rw name hfirrldctrl frint bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 hfirrldctrl 0 rw reload control this bit allows dynamic reloading of the hfir register during run time. this bit needs to be programmed during initial configuration and its value should not be changed during runtime. value mode description 0 static the hfir cannot be reloaded dynamically. 1 dynamic the hfir can be dynamically reloaded during runtime. 15:0 frint 0x17d7 rw frame interval the value that the application programs to this field specifies the interval between two consecutive sofs (fs) or keep-alive tokens (ls). this field contains the number of phy clocks that constitute the required frame interval. the application can write a value to this register only after the port enable bit of the host port control and status register (usb_hprt.prtena) has been set. if no value is programmed, the core calculates the value based on the phy clock specified in the fs/ls phy clock select field of the host configuration register (usb_hcfg.fslspclksel). do not change the value of this field after the initial configuration. set to 48000 (1 ms at 48 mhz) for fs and 6000 (1 ms at 6 mhz) for ls. 15.6.30 usb_hfnum - host frame number/frame time remaining register this register indicates the current frame number. it also indicates the time remaining (in terms of the number of phy clocks) in the current frame. offset bit position 0x3c408 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 0x3fff access r r name frrem frnum bit name reset access description 31:16 frrem 0x0000 r frame time remaining indicates the amount of time remaining in the current frame, in terms of phy clocks. this field decrements on each phy clock. when it reaches zero, this field is reloaded with the value in the frame interval register and a new sof is transmitted on the usb. 15:0 frnum 0x3fff r frame number this field increments when a new sof is transmitted on the usb, and is reset to 0 when it reaches 0x3fff.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 372 www.energymicro.com 15.6.31 usb_hptxsts - host periodic transmit fifo/queue status register this read-only register contains the free space information for the periodic txfifo and the periodic transmit request queue. offset bit position 0x3c410 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x08 0x0200 access r r r name ptxqtop ptxqspcavail ptxfspcavail bit name reset access description 31:24 ptxqtop 0x00 r top of the periodic transmit request queue this indicates the entry in the periodic tx request queue that is currently being processes by the mac. this register is used for debugging. bit [7]: odd/even frame. 0: send in even frame, 1: send in odd frame. bits [6:3]: channel/endpoint number. bits [2:1]: type. 00: in/out, 01: zero-length packet, 10: unused, 11: disable channel command. bit [0]: terminate (last entry for the selected channel/endpoint). 23:16 ptxqspcavail 0x08 r periodic transmit request queue space available indicates the number of free locations available to be written in the periodic transmit request queue. this queue holds both in and out requests. 15:0 ptxfspcavail 0x0200 r periodic transmit data fifo space available indicates the number of free locations available to be written to in the periodic txfifo. values are in terms of 32-bit words. 15.6.32 usb_haint - host all channels interrupt register when a significant event occurs on a channel, the host all channels interrupt register interrupts the application using the host channels interrupt bit of the core interrupt register (usb_gintsts.hchint). there is one interrupt bit per channel. bits in this register are set and cleared when the application sets and clears bits in the corresponding host channel x interrupt register. offset bit position 0x3c414 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access r name haint
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 373 www.energymicro.com bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:0 haint 0x0000 r channel interrupt for channel 0 - 13. when the interrupt bit for a channel x set, one or more of the interrupt flags in the usb_hcx_int are set. 15.6.33 usb_haintmsk - host all channels interrupt mask register the host all channel interrupt mask register works with the host all channel interrupt register to interrupt the application when an event occurs on a channel. there is one interrupt mask bit per channel. set bits to unmask. offset bit position 0x3c418 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name haintmsk bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:0 haintmsk 0x0000 rw channel interrupt mask for channel 0 - 13 set bit n to unmask channel n interrupts. 15.6.34 usb_hprt - host port control and status register this register is available only in host mode. this register holds usb port-related information such as usb reset, enable, suspend, resume, connect status, and test mode for the port. some bits in this register can trigger an interrupt to the application through the host port interrupt bit of the core interrupt register (usb_gintsts.prtint). on a port interrupt, the application must read this register and clear the bit that caused the interrupt. for the rw1 bits, the application must write a 1 to the bit to clear the interrupt. offset bit position 0x3c440 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0 0x0 0 0 0 0 0 0 0 0 0 access r rw rw r rw rw1 rw rw1 r rw1 rw1 rw1 r name prtspd prttstctl prtpwr prtlnsts prtrst prtsusp prtres prtovrcurrchng prtovrcurract prtenchng prtena prtconndet prtconnsts bit name reset access description 31:19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:17 prtspd 0x0 r port speed indicates the speed of the device attached to this port.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 374 www.energymicro.com bit name reset access description value mode description 0 hs high speed. 1 fs full speed. 2 ls low speed. 16:13 prttstctl 0x0 rw port test control the application writes a nonzero value to this field to put the port into a test mode, and the corresponding pattern is signaled on the port. value mode description 0 disable test mode disabled. 1 j test_j mode. 2 k test_k mode. 3 se0nak test_se0_nak mode. 4 packet test_packet mode. 5 force test_force_enable. 12 prtpwr 0 rw port power the application uses this field to control power to this port. the core can clear this bit on an over current condition. value mode description 0 off power off. 1 on power on. 11:10 prtlnsts 0x0 r port line status indicates the current logic level usb data lines. bit [0]: logic level of d+. bit [1]: logic level of d-. 9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 prtrst 0 rw port reset when the application sets this bit, a reset sequence is started on this port. the application must time the reset period and clear this bit after the reset sequence is complete. the application must leave this bit set for at least 10 ms to start a reset on the port. the application can leave it set for another 10 ms in addition to the required minimum duration, before clearing the bit, even though there is no maximum limit set by the usb standard. 7 prtsusp 0 rw1 port suspend the application sets this bit to put this port in suspend mode. the core only stops sending sofs when this is set. to stop the phy clock, the application must set usb_pcgcctl.stoppclk, which puts the phy into suspend mode. the read value of this bit reflects the current suspend status of the port. this bit is cleared by the core after a remote wakeup signal is detected or the application sets the port reset bit or port resume bit in this register or the resume/remote wakeup detected interrupt bit or disconnect detected interrupt bit in the core interrupt register (usb_gintsts.wkupint or usb_gintsts.disconnint respectively). this bit is cleared by the core even if there is no device connected to the host. 6 prtres 0 rw port resume the application sets this bit to drive resume signaling on the port. the core continues to drive the resume signal until the application clears this bit. if the core detects a usb remote wakeup sequence, as indicated by the port resume/remote wakeup detected interrupt bit of the core interrupt register (usb_gintsts.wkupint), the core starts driving resume signaling without application intervention and clears this bit when it detects a disconnect condition. the read value of this bit indicates whether the core is currently driving resume signaling. 5 prtovrcurrchng 0 rw1 port overcurrent change the core sets this bit when the status of the port overcurrent active bit (bit 4) in this register changes. this bit can be set only by the core and the application should write 1 to clear it. 4 prtovrcurract 0 r port overcurrent active indicates the overcurrent condition of the port. when there is an overcurrent condition this bit is 1. 3 prtenchng 0 rw1 port enable/disable change the core sets this bit when the status of the port enable bit[2] of this register changes. this bit can be set only by the core and the application should write 1 to clear it. 2 prtena 0 rw1 port enable a port is enabled only by the core after a reset sequence, and is disabled by an overcurrent condition, a disconnect condition, or by the application clearing this bit. the application cannot set this bit by a register write. it can only clear it to disable the port by writing 1. this bit does not trigger any interrupt to the application. 1 prtconndet 0 rw1 port connect detected
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 375 www.energymicro.com bit name reset access description the core sets this bit when a device connection is detected to trigger an interrupt to the application using the host port interrupt bit of the core interrupt register (usb_gintsts.prtint). this bit can be set only by the core and the application should write 1 to clear it. the application must write a 1 to this bit to clear the interrupt. 0 prtconnsts 0 r port connect status when this bit is 1 a device is attached to the port. 15.6.35 usb_hcx_char - host channel x characteristics register offset bit position 0x3c500 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0x00 0x0 0x0 0 0 0x0 0x000 access rw1 rw1 rw rw rw rw rw rw rw rw name chena chdis oddfrm devaddr mc eptype lspddev epdir epnum mps bit name reset access description 31 chena 0 rw1 channel enable this field is set by the application and cleared by the core. the state of this bit reflects the channel enable status. 30 chdis 0 rw1 channel disable the application sets this bit to stop transmitting/receiving data on a channel, even before the transfer for that channel is complete. the application must wait for the channel disabled interrupt before treating the channel as disabled. 29 oddfrm 0 rw odd frame this field is set (reset) by the application to indicate that the otg host must perform a transfer in an odd frame. this field is applicable for only periodic (isochronous and interrupt) transactions. 28:22 devaddr 0x00 rw device address this field selects the specific device serving as the data source or sink. 21:20 mc 0x0 rw multi count for periodic transfers this field indicates to the host the number of transactions that must be executed per frame for this periodic endpoint. for non-periodic transfers, this field is used only in dma mode, and specifies the number packets to be fetched for this channel before the internal dma engine changes arbitration. 19:18 eptype 0x0 rw endpoint type indicates the transfer type selected. value mode description 0 control control endpoint. 1 iso isochronous endpoint. 2 bulk bulk endpoint. 3 int interrupt endpoint. 17 lspddev 0 rw low-speed device this field is set by the application to indicate that this channel is communicating to a low-speed device. 16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 epdir 0 rw endpoint direction indicates whether the transaction is in or out. value mode description 0 out direction is out. 1 in direction is in.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 376 www.energymicro.com bit name reset access description 14:11 epnum 0x0 rw endpoint number indicates the endpoint number on the device serving as the data source or sink. 10:0 mps 0x000 rw maximum packet size indicates the maximum packet size of the associated endpoint. 15.6.36 usb_hcx_int - host channel x interrupt register this register indicates the status of a channel with respect to usb- and ahb-related events. the application must read this register when the host channels interrupt bit of the core interrupt register (usb_gintsts.hchint) is set. before the application can read this register, it must first read the host all channels interrupt (usb_haint) register to get the exact channel number for the host channel x interrupt register. the application must clear the appropriate bit in this register to clear the corresponding bits in the usb_haint and usb_gintsts registers. offset bit position 0x3c508 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 access rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 name datatglerr frmovrun bblerr xacterr ack nak stall ahberr chhltd xfercompl bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 datatglerr 0 rw1 data toggle error this bit can be set only by the core and the application should write 1 to clear it. 9 frmovrun 0 rw1 frame overrun this bit can be set only by the core and the application should write 1 to clear it. 8 bblerr 0 rw1 babble error this bit can be set only by the core and the application should write 1 to clear it. 7 xacterr 0 rw1 transaction error indicates one of the following errors occurred on the usb: crc check failure, timeout, bit stuff error or false eop. this bit can be set only by the core and the application should write 1 to clear it. 6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ack 0 rw1 ack response received/transmitted interrupt this bit can be set only by the core and the application should write 1 to clear it. 4 nak 0 rw1 nak response received interrupt this bit can be set only by the core and the application should write 1 to clear it. 3 stall 0 rw1 stall response received interrupt this bit can be set only by the core and the application should write 1 to clear it. 2 ahberr 0 rw1 ahb error this is generated only in dma mode when there is an ahb error during ahb read/write. the application can read the corresponding channel's dma address register to get the error address. 1 chhltd 0 rw1 channel halted in dma mode this bit indicates the transfer completed abnormally either because of any usb transaction error or in response to disable request by the application or because of a completed transfer.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 377 www.energymicro.com bit name reset access description 0 xfercompl 0 rw1 transfer completed transfer completed normally without any errors. this bit can be set only by the core and the application should write 1 to clear it. 15.6.37 usb_hcx_intmsk - host channel x interrupt mask register this register reflects the mask for each channel status described in the usb_chx_int. offset bit position 0x3c50c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw name datatglerrmsk frmovrunmsk bblerrmsk xacterrmsk ackmsk nakmsk stallmsk ahberrmsk chhltdmsk xfercomplmsk bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 datatglerrmsk 0 rw data toggle error mask set to unmask datatglerr interrupt. 9 frmovrunmsk 0 rw frame overrun mask set to unmask frmovrun interrupt. 8 bblerrmsk 0 rw babble error mask set to unmask bblerr interrupt. 7 xacterrmsk 0 rw transaction error mask set to unmask xacterr interrupt. 6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ackmsk 0 rw ack response received/transmitted interrupt mask set to unmask ack interrupt. 4 nakmsk 0 rw nak response received interrupt mask set to unmask nak interrupt. 3 stallmsk 0 rw stall response received interrupt mask set to unmask stall interrupt. 2 ahberrmsk 0 rw ahb error mask set to unmask ahberr interrupt. 1 chhltdmsk 0 rw channel halted mask set to unmask chhltd interrupt. 0 xfercomplmsk 0 rw transfer completed mask set to unmask xfercompl interrupt.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 378 www.energymicro.com 15.6.38 usb_hcx_tsiz - host channel x transfer size register offset bit position 0x3c510 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x000 0x00000 access rw rw rw name pid pktcnt xfersize bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:29 pid 0x0 rw packet id the application programs this field with the packet id type to use for the initial transaction. the host maintains this field for the rest of the transfer. value mode description 0 data0 data0 pid. 1 data2 data2 pid. 2 data1 data1 pid. 3 mdata mdata (non-control) / setup (control) pid. 28:19 pktcnt 0x000 rw packet count this field is programmed by the application with the expected number of packets to be transmitted (out) or received (in). the host decrements this count on every successful transmission or reception of an out/in packet. once this count reaches zero, the application is interrupted to indicate normal completion. 18:0 xfersize 0x00000 rw transfer size for an out, this field is the number of data bytes the host sends during the transfer. for an in, this field is the buffer size that the application has reserved for the transfer. the application is expected to program this field as an integer multiple of the maximum packet size for in transactions (periodic and non-periodic). 15.6.39 usb_hcx_dmaaddr - host channel x dma address register this register is used by the otg host in the internal dma mode to maintain the current buffer pointer for in/out transactions. the starting dma address must be dword-aligned. offset bit position 0x3c514 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name dmaaddr
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 379 www.energymicro.com bit name reset access description 31:0 dmaaddr 0xxxxxxxxx rw dma address this field holds the start address in the external memory from which the data for the endpoint must be fetched or to which it must be stored. this register is incremented on every ahb transaction. the data for this register field is stored in ram. thus, the reset value is undefined (x). 15.6.40 usb_dcfg - device configuration register this register configures the core in device mode after power-on or after certain control commands or enumeration. do not make changes to this register after initial programming. offset bit position 0x3c800 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x02 0x0 0x00 0 0 0x0 access rw rw rw rw rw rw name resvalid perfrint devaddr ena32khzsusp nzstsouthshk devspd bit name reset access description 31:26 resvalid 0x02 rw resume validation period this field is effective only when usb_dcfg.ena32khzsusp is set. it will control the resume period when the core resumes from suspend. the core counts for resvalid number of clock cycles to detect a valid resume when usb_dcfg.ena32khzsusp is set. 25:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12:11 perfrint 0x0 rw periodic frame interval indicates the time within a frame at which the application must be notified using the end of periodic frame interrupt. this can be used to determine if all the isochronous traffic for that frame is complete. value mode description 0 80pcnt 80% of the frame interval. 1 85pcnt 85% of the frame interval. 2 90pcnt 90% of the frame interval. 3 95pcnt 95% of the frame interval. 10:4 devaddr 0x00 rw device address the application must program this field after every setaddress control command. 3 ena32khzsusp 0 rw enable 32 khz suspend mode when this bit is set, the core expects that the phy clock during suspend is switched from 48 mhz to 32 khz. 2 nzstsouthshk 0 rw non-zero-length status out handshake the application can use this field to select the handshake the core sends on receiving a nonzero-length data packet during the out transaction of a control transfer's status stage. when set to 1 send a stall handshake on a nonzero-length status out transaction and do not send the received out packet to the application. when set to 0 send the received out packet to the application (zerolength or nonzero-length) and send a handshake based on the nak and stall bits for the endpoint in the device endpoint control register. 1:0 devspd 0x0 rw device speed indicates the speed at which the application requires the core to enumerate, or the maximum speed the application can support. however, the actual bus speed is determined only after the chirp sequence is completed, and is based on the speed of the usb host to which the core is connected. value mode description 2 ls low speed (phy clock is 6 mhz). if you select 6 mhz ls mode, you must do a soft reset. 3 fs full speed (phy clock is 48 mhz).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 380 www.energymicro.com 15.6.41 usb_dctl - device control register offset bit position 0x3c804 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0x0 0 0 0 0 access rw rw rw w1 w1 w1 w1 rw r r rw rw name nakonbble ignrfrmnum pwronprgdone cgoutnak sgoutnak cgnpinnak sgnpinnak tstctl goutnaksts gnpinnaksts sftdiscon rmtwkupsig bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 nakonbble 0 rw nak on babble error set nak automatically on babble. the core sets nak automatically for the endpoint on which babble is received. 15 ignrfrmnum 0 rw ignore frame number for isochronous end points when set to 0 the core transmits the packets only in the frame number in which they are intended to be transmitted. when set to 1 the core ignores the frame number, sending packets immediately as the packets are ready. 14:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 pwronprgdone 0 rw power-on programming done the application uses this bit to indicate that register programming is completed after a wake-up from power down mode. 10 cgoutnak 0 w1 clear global out nak a write to this field clears the global out nak. 9 sgoutnak 0 w1 set global out nak a write to this field sets the global out nak. the application uses this bit to send a nak handshake on all out endpoints. the application must set this bit only after making sure that the global out nak effective bit in the core interrupt register (usb_gintsts.goutnakeff) is cleared. 8 cgnpinnak 0 w1 clear global non-periodic in nak a write to this field clears the global non-periodic in nak. 7 sgnpinnak 0 w1 set global non-periodic in nak a write to this field sets the global non-periodic in nak. the application uses this bit to send a nak handshake on all non-periodic in endpoints. the application must set this bit only after making sure that the global in nak effective bit in the core interrupt register (usb_gintsts.ginnakeff) is cleared. 6:4 tstctl 0x0 rw test control set to a non-zero value to enable test control. value mode description 0 disable test mode disabled. 1 j test_j mode. 2 k test_k mode. 3 se0nak test_se0_nak mode. 4 packet test_packet mode. 5 force test_force_enable. 3 goutnaksts 0 r global out nak status when this bit is 0 a handshake is sent based on the fifo status and the nak and stall bit settings. when this bit is 1 no data is written to the rxfifo, irrespective of space availability. sends a nak handshake on all packets, except on setup transactions. all isochronous out packets are dropped. 2 gnpinnaksts 0 r global non-periodic in nak status when this bit is 0 a handshake is sent out based on the data availability in the transmit fifo. when this bit is 1 a nak handshake is sent out on all non-periodic in endpoints, irrespective of the data availability in the transmit fifo. 1 sftdiscon 0 rw soft disconnect
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 381 www.energymicro.com bit name reset access description the application uses this bit to signal the core to do a soft disconnect. as long as this bit is set, the host does not see that the device is connected, and the device does not receive signals on the usb. the core stays in the disconnected state until the application clears this bit. when suspended, the minimum duration for which the core must keep this bit set is 1 ms + 2.5 us. when idle or performing transactions, the minimum duration for which the core must keep this bit set is 2.5 us. 0 rmtwkupsig 0 rw remote wakeup signaling when the application sets this bit, the core initiates remote signaling to wake up the usb host. the application must set this bit to instruct the core to exit the suspend state. as specified in the usb 2.0 specification, the application must clear this bit 1-15 ms after setting it. 15.6.42 usb_dsts - device status register this register indicates the status of the core with respect to usb-related events. it must be read on interrupts from device all interrupts (usb_daint) register. offset bit position 0x3c808 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 0 0x1 0 access r r r r name soffn errticerr enumspd suspsts bit name reset access description 31:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21:8 soffn 0x0000 r frame number of the received sof this field contains a frame number. this field may return a non zero value if read immediately after power on reset. in case the register bits reads non zero immediately after power on reset it does not indicate that sof has been received from the host. the read value of this interrupt is valid only after a valid connection between host and device is established. 7:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 errticerr 0 r erratic error the core sets this bit to report any erratic errors (phy error) due to erratic errors, the core goes into suspended state and an interrupt is generated to the application with early suspend bit of the core interrupt register (usb_gintsts.erlysusp). if the early suspend is asserted due to an erratic error, the application can only perform a soft disconnect recover. 2:1 enumspd 0x1 r enumerated speed indicates the speed at which the core has come up after speed detection through a chirp sequence. value mode description 2 ls low speed (phy clock is running at 6 mhz). 3 fs full speed (phy clock is running at 48 mhz). 0 suspsts 0 r suspend status in device mode, this bit is set as long as a suspend condition is detected on the usb. the core enters the suspended state when there is no activity on the bus for an extended period of time. the core comes out of the suspend when there is any activity on the bus or when the application writes to the remote wakeup signaling bit in the device control register (usb_dctl.rmtwkupsig). 15.6.43 usb_diepmsk - device in endpoint common interrupt mask register this register works with each of the device in endpoint interrupt (usb_diep0int/usb_diepx_int) registers for all endpoints to generate an interrupt per in endpoint. the in endpoint interrupt for a specific
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 382 www.energymicro.com status in the usb_diep0int/usb_diepx_int register can be masked by writing to the corresponding bit in this register. status bits are masked by default. offset bit position 0x3c810 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw name nakmsk txfifoundrnmsk inepnakeffmsk intkntxfempmsk timeoutmsk ahberrmsk epdisbldmsk xfercomplmsk bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13 nakmsk 0 rw nak interrupt mask set to 1 to unmask nak interrupt. 12:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 txfifoundrnmsk 0 rw fifo underrun mask set to 1 to unmask txfifoundrn interrupt. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 inepnakeffmsk 0 rw in endpoint nak effective mask set to 1 to unmask inepnakeff interrupt. 5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 intkntxfempmsk 0 rw in token received when txfifo empty mask set to 1 to unmask intkntxfemp interrupt. 3 timeoutmsk 0 rw timeout condition mask set to 1 to unmask interrupt timeout. applies to non-isochronous endpoints. 2 ahberrmsk 0 rw ahb error mask set to 1 to unmask ahberr interrupt. 1 epdisbldmsk 0 rw endpoint disabled interrupt mask set to 1 to unmask epdisbld interrupt. 0 xfercomplmsk 0 rw transfer completed interrupt mask set to 1 to unmask xfercompl interrupt. 15.6.44 usb_doepmsk - device out endpoint common interrupt mask register this register works with each of the device out endpoint interrupt (usb_doep0int/ usb_doepx_int) registers for all endpoints to generate an interrupt per out endpoint. the out endpoint interrupt for a specific status in the usb_doep0int/usb_doepx_int register can be masked by writing into the corresponding bit in this register. status bits are masked by default.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 383 www.energymicro.com offset bit position 0x3c814 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw name nakmsk bbleerrmsk outpkterrmsk back2backsetup outtknepdismsk setupmsk ahberrmsk epdisbldmsk xfercomplmsk bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13 nakmsk 0 rw nak interrupt mask set to 1 to unmask nak interrupt. 12 bbleerrmsk 0 rw babble error interrupt mask set to 1 to unmask bbleerr interrupt. 11:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 outpkterrmsk 0 rw out packet error mask set to 1 to unmask outpkterr interrupt. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 back2backsetup 0 rw back-to-back setup packets received mask set to 1 to unmask back2backsetup interrupt. applies to control out endpoints only. 5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 outtknepdismsk 0 rw out token received when endpoint disabled mask set to 1 to unmask outtknepdis interrupt. applies to control out endpoints only. 3 setupmsk 0 rw setup phase done mask set to 1 to unmask setup interrupt. applies to control endpoints only. 2 ahberrmsk 0 rw ahb error set to 1 to unmask ahberr interrupt. 1 epdisbldmsk 0 rw endpoint disabled interrupt mask set to 1 to unmask epdisbld interrupt. 0 xfercomplmsk 0 rw transfer completed interrupt mask set to 1 to unmask xfercompl interrupt. 15.6.45 usb_daint - device all endpoints interrupt register when a significant event occurs on an endpoint, a device all endpoints interrupt register interrupts the application using the device out endpoints interrupt bit or device in endpoints interrupt bit of the core interrupt register (usb_gintsts.oepint or usb_gintsts.iepint, respectively). there is one interrupt bit per endpoint. for a bidirectional endpoint, the corresponding in and out interrupt bits are used. bits in this register are set and cleared when the application sets and clears bits in the corresponding device endpoint interrupt register (usb_diep0int/usb_diepx_int, usb_doep0int/ usb_doepx_int).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 384 www.energymicro.com offset bit position 0x3c818 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access r r r r r r r r r r r r r r name outepint6 outepint5 outepint4 outepint3 outepint2 outepint1 outepint0 inepint6 inepint5 inepint4 inepint3 inepint2 inepint1 inepint0 bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 outepint6 0 r out endpoint 6 interrupt bit this bit is set when on or more of the interrupt flags in usb_doep5_int are set. 21 outepint5 0 r out endpoint 5 interrupt bit this bit is set when one or more of the interrupt flags in usb_doep4_int are set. 20 outepint4 0 r out endpoint 4 interrupt bit this bit is set when one or more of the interrupt flags in usb_doep3_int are set. 19 outepint3 0 r out endpoint 3 interrupt bit this bit is set when one or more of the interrupt flags in usb_doep2_int are set. 18 outepint2 0 r out endpoint 2 interrupt bit this bit is set when one or more of the interrupt flags in usb_doep1_int are set. 17 outepint1 0 r out endpoint 1 interrupt bit this bit is set when one or more of the interrupt flags in usb_doep0_int are set. 16 outepint0 0 r out endpoint 0 interrupt bit this bit is set when one or more of the interrupt flags in usb_doep0int are set. 15:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 inepint6 0 r in endpoint 6 interrupt bit this bit is set when one or more of the interrupt flags in usb_diep5_int are set. 5 inepint5 0 r in endpoint 5 interrupt bit this bit is set when one or more of the interrupt flags in usb_diep4_int are set. 4 inepint4 0 r in endpoint 4 interrupt bit this bit is set when one or more of the interrupt flags in usb_diep3_int are set. 3 inepint3 0 r in endpoint 3 interrupt bit this bit is set when one or more of the interrupt flags in usb_diep2_int are set. 2 inepint2 0 r in endpoint 2 interrupt bit this bit is set when one or more of the interrupt flags in usb_diep1_int are set. 1 inepint1 0 r in endpoint 1 interrupt bit this bit is set when one or more of the interrupt flags in usb_diep0_int are set. 0 inepint0 0 r in endpoint 0 interrupt bit this bit is set when one or more of the interrupt flags in usb_diep0int are set. 15.6.46 usb_daintmsk - device all endpoints interrupt mask register the device endpoint interrupt mask register works with the device endpoint interrupt register to interrupt the application when an event occurs on a device endpoint. however, the device all endpoints interrupt (usb_daint) register bit corresponding to that interrupt is still set.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 385 www.energymicro.com offset bit position 0x3c81c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw name outepmsk6 outepmsk5 outepmsk4 outepmsk3 outepmsk2 outepmsk1 outepmsk0 inepmsk6 inepmsk5 inepmsk4 inepmsk3 inepmsk2 inepmsk1 inepmsk0 bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 outepmsk6 0 rw out endpoint 6 interrupt mask bit set to 1 to unmask usb_daint.outepint6. 21 outepmsk5 0 rw out endpoint 5 interrupt mask bit set to 1 to unmask usb_daint.outepint5. 20 outepmsk4 0 rw out endpoint 4 interrupt mask bit set to 1 to unmask usb_daint.outepint4. 19 outepmsk3 0 rw out endpoint 3 interrupt mask bit set to 1 to unmask usb_daint.outepint3. 18 outepmsk2 0 rw out endpoint 2 interrupt mask bit set to 1 to unmask usb_daint.outepint2. 17 outepmsk1 0 rw out endpoint 1 interrupt mask bit set to 1 to unmask usb_daint.outepint1. 16 outepmsk0 0 rw out endpoint 0 interrupt mask bit set to 1 to unmask usb_daint.outepint0. 15:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 inepmsk6 0 rw in endpoint 6 interrupt mask bit set to 1 to unmask usb_daint.inepint6. 5 inepmsk5 0 rw in endpoint 5 interrupt mask bit set to 1 to unmask usb_daint.inepint5. 4 inepmsk4 0 rw in endpoint 4 interrupt mask bit set to 1 to unmask usb_daint.inepint4. 3 inepmsk3 0 rw in endpoint 3 interrupt mask bit set to 1 to unmask usb_daint.inepint3. 2 inepmsk2 0 rw in endpoint 2 interrupt mask bit set to 1 to unmask usb_daint.inepint2. 1 inepmsk1 0 rw in endpoint 1 interrupt mask bit set to 1 to unmask usb_daint.inepint1. 0 inepmsk0 0 rw in endpoint 0 interrupt mask bit set to 1 to unmask usb_daint.inepint0. 15.6.47 usb_dvbusdis - device vbus discharge time register this register specifies the vbus discharge time after vbus pulsing during srp.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 386 www.energymicro.com offset bit position 0x3c828 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x17d7 access rw name dvbusdis bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 dvbusdis 0x17d7 rw device vbus discharge time specifies the vbus discharge time after vbus pulsing during srp. this value equals vbus discharge time in phy clocks / 1024. depending on your vbus load, this value can need adjustment. 15.6.48 usb_dvbuspulse - device vbus pulsing time register this register specifies the vbus pulsing time during srp. offset bit position 0x3c82c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x5b8 access rw name dvbuspulse bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:0 dvbuspulse 0x5b8 rw device vbus pulsing time specifies the vbus pulsing time during srp. this value equals vbus pulsing time in phy clocks / 1024. 15.6.49 usb_diepempmsk - device in endpoint fifo empty interrupt mask register this register is used to control the in endpoint fifo empty interrupt generation (usb_diep0int/ usb_diepx_int.txfemp).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 387 www.energymicro.com offset bit position 0x3c834 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name diepempmsk bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 diepempmsk 0x0000 rw in ep tx fifo empty interrupt mask bits these bits acts as mask bits for usb_diep0int.txfemp/usb_diepx_int.txfemp interrupt. one bit per in endpoint: bit 0 for in ep 0, bit 6 for in ep 6. 15.6.50 usb_diep0ctl - device in endpoint 0 control register this section describes the control in endpoint 0 control register. nonzero control endpoints use registers for endpoints 1 - 6. offset bit position 0x3c900 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0x0 0 0x0 0 1 0x0 access rw1 rw1 w1 w1 rw rw1 r r r rw name epena epdis snak cnak txfnum stall eptype naksts usbactep mps bit name reset access description 31 epena 0 rw1 endpoint enable in dma mode this bit indicates that data is ready to be transmitted on the endpoint. the core clears this bit before setting the following interrupts on this endpoint: endpoint disabled, transfer completed. 30 epdis 0 rw1 endpoint disable the application sets this bit to stop transmitting data on an endpoint, even before the transfer for that endpoint is complete. the application must wait for the endpoint disabled interrupt before treating the endpoint as disabled. the core clears this bit before setting the endpoint disabled interrupt. the application must set this bit only if endpoint enable is already set for this endpoint. 29:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27 snak 0 w1 set nak a write to this bit sets the nak bit for the endpoint. using this bit, the application can control the transmission of nak handshakes on an endpoint. the core can also set this bit for an endpoint after a setup packet is received on that endpoint. 26 cnak 0 w1 clear nak a write to this bit clears the nak bit for the endpoint. 25:22 txfnum 0x0 rw txfifo number this value is set to the fifo number that is assigned to in endpoint 0. 21 stall 0 rw1 handshake the application can only set this bit, and the core clears it, when a setup token is received for this endpoint. if a nak bit, global nonperiodic in nak, or global out nak is set along with this bit, the stall bit takes priority.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 388 www.energymicro.com bit name reset access description 20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19:18 eptype 0x0 r endpoint type hardcoded to 0. endpoint 0 is always a control endpoint. 17 naksts 0 r nak status when this bit is 0 the core is transmitting non-nak handshakes based on the fifo status. when this bit is 1 the core is transmitting nak handshakes on this endpoint. when this bit is set, either by the application or core, the core stops transmitting data, even if there is data available in the txfifo. irrespective of this bit's setting, the core always responds to setup data packets with an ack handshake. 16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 usbactep 1 r usb active endpoint this bit is always 1, indicating that control endpoint 0 is always active in all configurations and interfaces. 14:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 mps 0x0 rw maximum packet size the application must program this field with the maximum packet size for the current logical endpoint. value mode description 0 64b 64 bytes. 1 32b 32 bytes. 2 16b 16 bytes. 3 8b 8 bytes. 15.6.51 usb_diep0int - device in endpoint 0 interrupt register this register indicates the status of endpoint 0 with respect to usb- and ahb-related events. the application must read this register when the in endpoints interrupt bit of the core interrupt register (usb_gintsts.iepint) is set. before the application can read this register, it must first read the device all endpoints interrupt (usb_daint) register to get the exact endpoint number for the device endpoint interrupt register. the application must clear the appropriate bit in this register to clear the corresponding bits in the usb_daint and usb_gintsts registers. offset bit position 0x3c908 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 1 0 0 0 0 0 0 access rw1 rw1 rw1 r rw1 rw1 rw1 rw1 rw1 rw1 name nakintrpt bbleerr pktdrpsts txfemp inepnakeff intkntxfemp timeout ahberr epdisbld xfercompl bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13 nakintrpt 0 rw1 nak interrupt the core generates this interrupt when a nak is transmitted or received by the device. in case of isochronous in endpoints the interrupt gets generated when a zero length packet is transmitted due to un-availability of data in the txfifo. 12 bbleerr 0 rw1 nak interrupt the core generates this interrupt when babble is received for the endpoint. 11 pktdrpsts 0 rw1 packet drop status this bit indicates to the application that an iso out packet has been dropped. this bit does not have an associated mask bit and does not generate an interrupt.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 389 www.energymicro.com bit name reset access description 10:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 txfemp 1 r transmit fifo empty this interrupt is asserted when the txfifo for this endpoint is either half or completely empty. the half or completely empty status is determined by the txfifo empty level bit in the core ahb configuration register (usb_gahbcfg.nptxfemplvl). 6 inepnakeff 0 rw1 in endpoint nak effective applies to periodic in endpoints only. this bit can be cleared when the application clears the in endpoint nak by writing to usb_diep0ctl.cnak. this interrupt indicates that the core has sampled the nak bit set (either by the application or by the core). the interrupt indicates that the in endpoint nak bit set by the application has taken effect in the core. this interrupt does not guarantee that a nak handshake is sent on the usb. a stall bit takes priority over a nak bit. 5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 intkntxfemp 0 rw1 in token received when txfifo is empty indicates that an in token was received when the associated txfifo (periodic/non-periodic) was empty. this interrupt is asserted on the endpoint for which the in token was received. 3 timeout 0 rw1 timeout condition indicates that the core has detected a timeout condition on the usb for the last in token on this endpoint. 2 ahberr 0 rw1 ahb error this is generated in dma mode when there is an ahb error during an ahb read/write. the application can read the corresponding endpoint dma address register to get the error address. 1 epdisbld 0 rw1 endpoint disabled interrupt this bit indicates that the endpoint is disabled per the application's request. 0 xfercompl 0 rw1 transfer completed interrupt this field indicates that the programmed transfer is complete on the ahb as well as on the usb, for this endpoint. 15.6.52 usb_diep0tsiz - device in endpoint 0 transfer size register the application must modify this register before enabling endpoint 0. once endpoint 0 is enabled using endpoint enable bit of the device control endpoint 0 control register (usb_diep0ctl.epena), the core modifies this register. the application can only read this register once the core has cleared the endpoint enable bit. nonzero endpoints use the registers for endpoints 1-6. offset bit position 0x3c910 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x00 access rw rw name pktcnt xfersize bit name reset access description 31:21 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 20:19 pktcnt 0x0 rw packet count indicates the total number of usb packets that constitute the transfer size amount of data for endpoint 0. this field is decremented every time a packet (maximum size or short packet) is read from the txfifo. 18:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:0 xfersize 0x00 rw transfer size indicates the transfer size in bytes for endpoint 0. the core interrupts the application only after it has exhausted the transfer size amount of data. the transfer size can be set to the maximum packet size of the endpoint, to be interrupted at the end of each packet. the core decrements this field every time a packet from the external memory is written to the txfifo.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 390 www.energymicro.com 15.6.53 usb_diep0dmaaddr - device in endpoint 0 dma address register offset bit position 0x3c914 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name diep0dmaaddr bit name reset access description 31:0 diep0dmaaddr 0xxxxxxxxx rw dma address holds the start address of the external memory for fetching endpoint data. for control endpoints, this field stores control out data packets as well as setup transaction data packets. when more than three setup packets are received back-to-back, the setup data packet in the memory is overwritten. this register is incremented on every ahb transaction. the application can give only a dword-aligned address. the data for this register field is stored in ram. thus, the reset value is undefined (x). 15.6.54 usb_diep0txfsts - device in endpoint 0 transmit fifo status register this read-only register contains the free space information for the device in endpoint 0 txfifo. offset bit position 0x3c918 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0200 access r name spcavail bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 spcavail 0x0200 r txfifo space available indicates the amount of free space available in the endpoint txfifo. values are in terms of 32-bit words. 15.6.55 usb_diepx_ctl - device in endpoint x+1 control register the application uses this register to control the behavior of each logical endpoint other than endpoint 0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 391 www.energymicro.com offset bit position 0x3c920 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0x0 0 0x0 0 0 0 0x000 access rw1 rw1 w1 w1 w1 w1 rw rw1 rw r r rw rw name epena epdis setd1pidof setd0pidef snak cnak txfnum stall eptype naksts dpideof usbactep mps bit name reset access description 31 epena 0 rw1 endpoint enable in dma mode for in endpoints, this bit indicates that data is ready to be transmitted on the endpoint. the core clears this bit before setting any of the following interrupts on this endpoint: setup phase done, endpoint disabled, transfer completed. for control endpoints in dma mode, this bit must be set to be able to transfer setup data packets in memory. 30 epdis 0 rw1 endpoint disable the application sets this bit to stop transmitting/receiving data on an endpoint, even before the transfer for that endpoint is complete. the application must wait for the endpoint disabled interrupt before treating the endpoint as disabled. the core clears this bit before setting the endpoint disabled interrupt. the application must set this bit only if endpoint enable is already set for this endpoint. 29 setd1pidof 0 w1 set data1 pid / odd frame for bulk and interrupt endpoints writing this field sets the endpoint data pid / even or odd frame (dpideof) field in this register to data1odd. for isochronous endpoints writing this field sets the endpoint data pid / even or odd frame (dpideof) field to odd (data1odd). 28 setd0pidef 0 w1 set data0 pid / even frame for bulk and interrupt endpoints writing this field sets the endpoint data pid / even or odd frame (dpideof) field in this register to data0even. for isochronous endpoints writing this field sets the endpoint data pid / even or odd frame (dpideof) field to odd (data0even). 27 snak 0 w1 set nak a write to this bit sets the nak bit for the endpoint. using this bit, the application can control the transmission of nak handshakes on an endpoint. the core can also set this bit for an endpoint after a setup packet is received on that endpoint. 26 cnak 0 w1 clear nak a write to this bit clears the nak bit for the endpoint. 25:22 txfnum 0x0 rw txfifo number these bits specify the fifo number associated with this endpoint. each active in endpoint must be programmed to a separate fifo number. this field is valid only for in endpoints. 21 stall 0 rw1 handshake for bulk and interrupt endpoints: the application sets this bit to stall all tokens from the usb host to this endpoint. if a nak bit, global non-periodic in nak, or global out nak is set along with this bit, the stall bit takes priority. in this case only the application can clear this bit, never the core. when control endpoint: the application can only set this bit, and the core clears it, when a setup token is received for this endpoint. if a nak bit, global non-periodic in nak, or global out nak is set along with this bit, the stall bit takes priority. irrespective of this bit's setting, the core always responds to setup data packets with an ack handshake. 20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19:18 eptype 0x0 rw endpoint type this is the transfer type supported by this logical endpoint. value mode description 0 control control endpoint. 1 iso isochronous endpoint. 2 bulk bulk endpoint. 3 int interrupt endpoint. 17 naksts 0 r nak status
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 392 www.energymicro.com bit name reset access description when this bit is 0 the core is transmitting non-nak handshakes based on the fifo status. when this bit is 1 the core is transmitting nak handshakes on this endpoint. when either the application or the core sets this bit the core stops receiving any data on an out endpoint, even if there is space in the rxfifo to accommodate the incoming packet. for non-isochronous in endpoints the core stops transmitting any data on an in endpoint, even if there data is available in the txfifo. for isochronous in endpoints the core sends out a zero-length data packet, even if there data is available in the txfifo. irrespective of this bit's setting, the core always responds to setup data packets with an ack handshake. 16 dpideof 0 r endpoint data pid / even or odd frame for interrupt/bulk endpoints this field contains the pid of the packet to be received or transmitted on this endpoint. the application must program the pid of the first packet to be received or transmitted on this endpoint, after the endpoint is activated. the applications use the setd1pidof and setd0pidef fields of this register to program either data0 or data1 pid. for isochronous endpoints, this field indicates the frame number in which the core transmits/receives isochronous data for this endpoint. the application must program the even/odd frame number in which it intends to transmit/receive isochronous data for this endpoint using the setd0pidef and setd1pidof fields in this register. value mode description 0 data0even data0 pid / even frame. 1 data1odd data1 pid / odd frame. 15 usbactep 0 rw usb active endpoint indicates whether this endpoint is active in the current configuration and interface. the core clears this bit for all endpoints after detecting a usb reset. after receiving the setconfiguration and setinterface commands, the application must program endpoint registers accordingly and set this bit. 14:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:0 mps 0x000 rw maximum packet size the application must program this field with the maximum packet size for the current logical endpoint. this value is in bytes. 15.6.56 usb_diepx_int - device in endpoint x+1 interrupt register this register indicates the status of an endpoint with respect to usb- and ahb-related events. the application must read this register when the in endpoints interrupt bit of the core interrupt register (usb_gintsts.iepint) is set. before the application can read this register, it must first read the device all endpoints interrupt (usb_daint) register to get the exact endpoint number for the device endpoint x+1 interrupt register. the application must clear the appropriate bit in this register to clear the corresponding bits in the usb_daint and usb_gintsts registers. offset bit position 0x3c928 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 1 0 0 0 0 0 0 access rw1 rw1 rw1 r rw1 rw1 rw1 rw1 rw1 rw1 name nakintrpt bbleerr pktdrpsts txfemp inepnakeff intkntxfemp timeout ahberr epdisbld xfercompl bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13 nakintrpt 0 rw1 nak interrupt the core generates this interrupt when a nak is transmitted or received by the device. in case of isochronous in endpoints the interrupt gets generated when a zero length packet is transmitted due to un-availability of data in the txfifo. 12 bbleerr 0 rw1 nak interrupt the core generates this interrupt when babble is received for the endpoint. 11 pktdrpsts 0 rw1 packet drop status this bit indicates to the application that an iso out packet has been dropped. this bit does not have an associated mask bit and does not generate an interrupt.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 393 www.energymicro.com bit name reset access description 10:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 txfemp 1 r transmit fifo empty this interrupt is asserted when the txfifo for this endpoint is either half or completely empty. the half or completely empty status is determined by the txfifo empty level bit in the core ahb configuration register (usb_gahbcfg.nptxfemplvl). 6 inepnakeff 0 rw1 in endpoint nak effective applies to periodic in endpoints only. this bit can be cleared when the application clears the in endpoint nak by writing to usb_diepx_ctl.cnak. this interrupt indicates that the core has sampled the nak bit set (either by the application or by the core). the interrupt indicates that the in endpoint nak bit set by the application has taken effect in the core. this interrupt does not guarantee that a nak handshake is sent on the usb. a stall bit takes priority over a nak bit. 5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 intkntxfemp 0 rw1 in token received when txfifo is empty applies to non-periodic in endpoints only. indicates that an in token was received when the associated txfifo (periodic/non- periodic) was empty. this interrupt is asserted on the endpoint for which the in token was received. 3 timeout 0 rw1 timeout condition applies only to control in endpoints. indicates that the core has detected a timeout condition on the usb for the last in token on this endpoint. 2 ahberr 0 rw1 ahb error this is generated only in dma mode when there is an ahb error during an ahb read/write. the application can read the corresponding endpoint dma address register to get the error address. 1 epdisbld 0 rw1 endpoint disabled interrupt this bit indicates that the endpoint is disabled per the application's request. 0 xfercompl 0 rw1 transfer completed interrupt this field indicates that the programmed transfer is complete on the ahb as well as on the usb, for this endpoint. 15.6.57 usb_diepx_tsiz - device in endpoint x+1 transfer size register the application must modify this register before enabling the endpoint. once the endpoint is enabled using endpoint enable bit of the device endpoint x+1 control register (usb_diepx_ctl.epena), the core modifies this register. the application can only read this register once the core has cleared the endpoint enable bit. offset bit position 0x3c930 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x000 0x00000 access rw rw rw name mc pktcnt xfersize bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:29 mc 0x0 rw multi count for periodic in endpoints, this field indicates the number of packets that must be transmitted per frame on the usb. the core uses this field to calculate the data pid for isochronous in endpoints. 28:19 pktcnt 0x000 rw packet count indicates the total number of usb packets that constitute the transfer size amount of data. this field is decremented every time a packet (maximum size or short packet) is read from the txfifo.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 394 www.energymicro.com bit name reset access description 18:0 xfersize 0x00000 rw transfer size indicates the transfer size in bytes. the core interrupts the application only after it has exhausted the transfer size amount of data. the transfer size can be set to the maximum packet size of the endpoint, to be interrupted at the end of each packet. the core decrements this field every time a packet from the external memory is written to the txfifo. 15.6.58 usb_diepx_dmaaddr - device in endpoint x+1 dma address register offset bit position 0x3c934 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name dmaaddr bit name reset access description 31:0 dmaaddr 0xxxxxxxxx rw dma address holds the start address of the external memory for fetching endpoint data. for control endpoints, this field stores control out data packets as well as setup transaction data packets. when more than three setup packets are received back-to-back, the setup data packet in the memory is overwritten. this register is incremented on every ahb transaction. the application can give only a dword-aligned address. the data for this register field is stored in ram. thus, the reset value is undefined (x). 15.6.59 usb_diepx_txfsts - device in endpoint x+1 transmit fifo status register this read-only register contains the free space information for the device in endpoint txfifo. offset bit position 0x3c938 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0200 access r name spcavail bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 spcavail 0x0200 r txfifo space available indicates the amount of free space available in the endpoint txfifo. values are in terms of 32-bit words.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 395 www.energymicro.com 15.6.60 usb_doep0ctl - device out endpoint 0 control register the application uses this register to control the behavior of each logical endpoint other than endpoint 0. offset bit position 0x3cb00 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0x0 0 1 0x0 access rw1 r w1 w1 rw1 rw r r r r name epena epdis snak cnak stall snp eptype naksts usbactep mps bit name reset access description 31 epena 0 rw1 endpoint enable in dma mode this bit indicates that the application has allocated the memory to start receiving data from the usb. the core clears this bit before setting any of the following interrupts on this endpoint: setup phase done, endpoint disabled, transfer completed. in dma mode, this bit must be set for the core to transfer setup data packets into memory. 30 epdis 0 r endpoint disable this bit is always 0. the application cannot disable control out endpoint 0. 29:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27 snak 0 w1 set nak a write to this bit sets the nak bit for the endpoint. using this bit, the application can control the transmission of nak handshakes on an endpoint. the core can also set bit on a transfer completed interrupt, or after a setup is received on the endpoint. 26 cnak 0 w1 clear nak a write to this bit clears the nak bit for the endpoint. 25:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21 stall 0 rw1 handshake the application can only set this bit, and the core clears it, when a setup token is received for this endpoint. if a nak bit or global out nak is set along with this bit, the stall bit takes priority. irrespective of this bit's setting, the core always responds to setup data packets with an ack handshake. 20 snp 0 rw snoop mode this bit configures the endpoint to snoop mode. in snoop mode, the core does not check the correctness of out packets before transferring them to application memory. 19:18 eptype 0x0 r endpoint type hardcoded to 0. endpoint 0 is always a control endpoint. 17 naksts 0 r nak status when this bit is 0 the core is transmitting non-nak handshakes based on the fifo status. when this bit is 1 the core is transmitting nak handshakes on this endpoint. when either the application or the core sets this bit, the core stops receiving data, even if there is space in the rxfifo to accommodate the incoming packet. irrespective of this bit's setting, the core always responds to setup data packets with an ack handshake. 16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 usbactep 1 r usb active endpoint this bit is always 1, indicating that a control endpoint 0 is always active in all configurations and interfaces. 14:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 mps 0x0 r maximum packet size the maximum packet size for control out endpoint 0 is the same as what is programmed in control in endpoint 0. value mode description 0 64b 64 bytes. 1 32b 32 bytes. 2 16b 16 bytes.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 396 www.energymicro.com bit name reset access description value mode description 3 8b 8 bytes. 15.6.61 usb_doep0int - device out endpoint 0 interrupt register this register indicates the status of endpoint 0 with respect to usb- and ahb-related events. the application must read this register when the out endpoints interrupt bit of the core interrupt register (usb_gintsts.oepint) is set. before the application can read this register, it must first read the device all endpoints interrupt (usb_daint) register to get the exact endpoint number for the device endpoint interrupt register. the application must clear the appropriate bit in this register to clear the corresponding bits in the usb_daint and usb_gintsts registers. offset bit position 0x3cb08 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 access rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 name nakintrpt bbleerr pktdrpsts back2backsetup outtknepdis setup ahberr epdisbld xfercompl bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13 nakintrpt 0 rw1 nak interrupt the core generates this interrupt when a nak is transmitted or received by the device. in case of isochronous in endpoints the interrupt gets generated when a zero length packet is transmitted due to un-availability of data in the txfifo. 12 bbleerr 0 rw1 nak interrupt the core generates this interrupt when babble is received for the endpoint. 11 pktdrpsts 0 rw1 packet drop status this bit indicates to the application that an iso out packet has been dropped. this bit does not have an associated mask bit and does not generate an interrupt. 10:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 back2backsetup 0 rw1 back-to-back setup packets received this bit indicates that the core has received more than three back-to-back setup packets for this particular endpoint. 5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 outtknepdis 0 rw1 out token received when endpoint disabled indicates that an out token was received when the endpoint was not yet enabled. this interrupt is asserted on the endpoint for which the out token was received. 3 setup 0 rw1 setup phase done indicates that the setup phase for the control endpoint is complete and no more back-to-back setup packets were received for the current control transfer. on this interrupt, the application can decode the received setup data packet. 2 ahberr 0 rw1 ahb error this is generated only in dma mode when there is an ahb error during an ahb read/write. the application can read the corresponding endpoint dma address register to get the error address. 1 epdisbld 0 rw1 endpoint disabled interrupt this bit indicates that the endpoint is disabled per the application's request. 0 xfercompl 0 rw1 transfer completed interrupt
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 397 www.energymicro.com bit name reset access description this field indicates that the programmed transfer is complete on the ahb as well as on the usb, for this endpoint. 15.6.62 usb_doep0tsiz - device out endpoint 0 transfer size register the application must modify this register before enabling the endpoint. once the endpoint is enabled using endpoint enable bit of the device endpoint x+1 control register (usb_doepx_ctl.epena), the core modifies this register. the application can only read this register once the core has cleared the endpoint enable bit. offset bit position 0x3cb10 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0x00 access rw rw rw name supcnt pktcnt xfersize bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:29 supcnt 0x0 rw setup packet count this field specifies the number of back-to-back setup data packets the endpoint can receive. 28:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19 pktcnt 0 rw packet count this field is decremented to zero after a packet is written into the rxfifo. 18:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:0 xfersize 0x00 rw transfer size indicates the transfer size in bytes for endpoint 0. the core interrupts the application only after it has exhausted the transfer size amount of data. the transfer size can be set to the maximum packet size of the endpoint, to be interrupted at the end of each packet. the core decrements this field every time a packet is read from the rxfifo and written to the external memory. 15.6.63 usb_doep0dmaaddr - device out endpoint 0 dma address register offset bit position 0x3cb14 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name doep0dmaaddr
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 398 www.energymicro.com bit name reset access description 31:0 doep0dmaaddr 0xxxxxxxxx rw dma address holds the start address of the external memory for storing endpoint data. for control endpoints, this field stores control out data packets as well as setup transaction data packets. when more than three setup packets are received back-to-back, the setup data packet in the memory is overwritten. this register is incremented on every ahb transaction. the application can give only a dword-aligned address. the data for this register field is stored in ram. thus, the reset value is undefined (x). 15.6.64 usb_doepx_ctl - device out endpoint x+1 control register the application uses this register to control the behavior of each logical endpoint other than endpoint 0. offset bit position 0x3cb20 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0x0 0 0 0 0x000 access rw1 rw1 w1 w1 w1 w1 rw1 rw rw r r rw rw name epena epdis setd1pidof setd0pidef snak cnak stall snp eptype naksts dpideof usbactep mps bit name reset access description 31 epena 0 rw1 endpoint enable in dma mode this bit indicates that the application has allocated the memory to start receiving data from the usb. the core clears this bit before setting any of the following interrupts on this endpoint: setup phase done, endpoint disabled, transfer completed. for control endpoints in dma mode, this bit must be set to be able to transfer setup data packets in memory. 30 epdis 0 rw1 endpoint disable the application sets this bit to stop transmitting/receiving data on an endpoint, even before the transfer for that endpoint is complete. the application must wait for the endpoint disabled interrupt before treating the endpoint as disabled. the core clears this bit before setting the endpoint disabled interrupt. the application must set this bit only if endpoint enable is already set for this endpoint. 29 setd1pidof 0 w1 set data1 pid / odd frame for bulk and interrupt endpoints writing this field sets the endpoint data pid / even or odd frame (dpideof) field in this register to data1odd. for isochronous endpoints writing this field sets the endpoint data pid / even or odd frame (dpideof) field to odd (data1odd). 28 setd0pidef 0 w1 set data0 pid / even frame for bulk and interrupt endpoints writing this field sets the endpoint data pid / even or odd frame (dpideof) field in this register to data0even. for isochronous endpoints writing this field sets the endpoint data pid / even or odd frame (dpideof) field to odd (data0even). 27 snak 0 w1 set nak a write to this bit sets the nak bit for the endpoint. using this bit, the application can control the transmission of nak handshakes on an endpoint. the core can also set this bit for an endpoint after a setup packet is received on that endpoint. 26 cnak 0 w1 clear nak a write to this bit clears the nak bit for the endpoint. 25:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21 stall 0 rw1 stall handshake for non-control, non-isochronous endpoints: the application sets this bit to stall all tokens from the usb host to this endpoint. if a nak bit, global non-periodic in nak, or global out nak is set along with this bit, the stall bit takes priority. only the application can clear this bit, never the core. for control endpoints: the application can only set this bit, and the core clears it, when a setup token is received for this endpoint. if a nak bit, global non-periodic in nak, or global out nak is set along with this bit, the stall bit takes priority. irrespective of this bit's setting, the core always responds to setup data packets with an ack handshake. 20 snp 0 rw snoop mode this bit configures the endpoint to snoop mode. in snoop mode, the core does not check the correctness of out packets before transferring them to application memory.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 399 www.energymicro.com bit name reset access description 19:18 eptype 0x0 rw endpoint type this is the transfer type supported by this logical endpoint. value mode description 0 control control endpoint. 1 iso isochronous endpoint. 2 bulk bulk endpoint. 3 int interrupt endpoint. 17 naksts 0 r nak status when this bit is 0 the core is transmitting non-nak handshakes based on the fifo status. when this bit is 1 the core is transmitting nak handshakes on this endpoint. when either the application or the core sets this bit the core stops receiving any data on an out endpoint, even if there is space in the rxfifo to accommodate the incoming packet. irrespective of this bit's setting, the core always responds to setup data packets with an ack handshake. 16 dpideof 0 r endpoint data pid / even-odd frame for interrupt/bulk endpoints: contains the pid of the packet to be received or transmitted on this endpoint. the application must program the pid of the first packet to be received or transmitted on this endpoint, after the endpoint is activated. the application use the setd1pidof and setd0pidef fields of this register to program either data0 or data1 pid. for isochronous endpoints: indicates the frame number in which the core transmits/receives isochronous data for this endpoint. the application must program the even/odd frame number in which it intends to transmit/receive isochronous data for this endpoint using the setd1pidof and setd0pidef fields in this register. value mode description 0 data0even data0 pid / even frame. 1 data1odd data1 pid / odd frame. 15 usbactep 0 rw usb active endpoint indicates whether this endpoint is active in the current configuration and interface. the core clears this bit for all endpoints after detecting a usb reset. after receiving the setconfiguration and setinterface commands, the application must program endpoint registers accordingly and set this bit. 14:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:0 mps 0x000 rw maximum packet size the application must program this field with the maximum packet size for the current logical endpoint. this value is in bytes. 15.6.65 usb_doepx_int - device out endpoint x+1 interrupt register this register indicates the status of an endpoint with respect to usb- and ahb-related events. the application must read this register when the out endpoints interrupt bit of the core interrupt register (usb_gintsts.oepint) is set. before the application can read this register, it must first read the device all endpoints interrupt (usb_daint) register to get the exact endpoint number for the device endpoint interrupt register. the application must clear the appropriate bit in this register to clear the corresponding bits in the usb_daint and usb_gintsts registers. offset bit position 0x3cb28 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 access rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 rw1 name nakintrpt bbleerr pktdrpsts back2backsetup outtknepdis setup ahberr epdisbld xfercompl bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 400 www.energymicro.com bit name reset access description 13 nakintrpt 0 rw1 nak interrupt the core generates this interrupt when a nak is transmitted or received by the device. 12 bbleerr 0 rw1 babble error the core generates this interrupt when babble is received for the endpoint. 11 pktdrpsts 0 rw1 packet drop status this bit indicates to the application that an iso out packet has been dropped. this bit does not have an associated mask bit and does not generate an interrupt. 10:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 back2backsetup 0 rw1 back-to-back setup packets received applies to control out endpoints only. this bit indicates that the core has received more than three back-to-back setup packets for this particular endpoint. 5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 outtknepdis 0 rw1 out token received when endpoint disabled applies only to control out endpoints. indicates that an out token was received when the endpoint was not yet enabled. this interrupt is asserted on the endpoint for which the out token was received. 3 setup 0 rw1 setup phase done applies to control out endpoints only. indicates that the setup phase for the control endpoint is complete and no more back- to-back setup packets were received for the current control transfer. on this interrupt, the application can decode the received setup data packet. 2 ahberr 0 rw1 ahb error this is generated only in dma mode when there is an ahb error during an ahb read/write. the application can read the corresponding endpoint dma address register to get the error address. 1 epdisbld 0 rw1 endpoint disabled interrupt this bit indicates that the endpoint is disabled per the application's request. 0 xfercompl 0 rw1 transfer completed interrupt this field indicates that the programmed transfer is complete on the ahb as well as on the usb, for this endpoint. 15.6.66 usb_doepx_tsiz - device out endpoint x+1 transfer size register the application must modify this register before enabling the endpoint. once the endpoint is enabled using endpoint enable bit of the device endpoint x+1 control register (usb_doepx_ctl.epena), the core modifies this register. the application can only read this register once the core has cleared the endpoint enable bit. offset bit position 0x3cb30 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x000 0x00000 access r rw rw name rxdpidsupcnt pktcnt xfersize bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 401 www.energymicro.com bit name reset access description 30:29 rxdpidsupcnt 0x0 r receive data pid / setup packet count for isochronous out endpoints: this is the data pid received in the last packet for this endpoint. for control out endpoints: this field specifies the number of back-to-back setup data packets the endpoint can receive. value mode description 0 data0 data0 pid. 1 data2 data2 pid / 1 packet. 2 data1 data1 pid / 2 packets. 3 mdata mdata pid / 3 packets. 28:19 pktcnt 0x000 rw packet count this field is decremented to zero after a packet is written into the rxfifo. 18:0 xfersize 0x00000 rw transfer size indicates the transfer size in bytes. the core interrupts the application only after it has exhausted the transfer size amount of data. the transfer size can be set to the maximum packet size of the endpoint, to be interrupted at the end of each packet. the core decrements this field every time a packet is read from the rxfifo and written to the external memory. 15.6.67 usb_doepx_dmaaddr - device out endpoint x+1 dma address register offset bit position 0x3cb34 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name dmaaddr bit name reset access description 31:0 dmaaddr 0xxxxxxxxx rw dma address holds the start address of the external memory for storing endpoint data. for control endpoints, this field stores control out data packets as well as setup transaction data packets. when more than three setup packets are received back-to-back, the setup data packet in the memory is overwritten. this register is incremented on every ahb transaction. the application can give only a dword-aligned address. the data for this register field is stored in ram. thus, the reset value is undefined (x). 15.6.68 usb_pcgcctl - power and clock gating control register this register is available in host and device modes. the application use this register to control the core's power-down and clock gating features.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 402 www.energymicro.com offset bit position 0x3ce00 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access r r rw rw rw rw name resetaftersusp physleep rstpdwnmodule pwrclmp gatehclk stoppclk bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 resetaftersusp 0 r reset after suspend when exiting em2, this bit needs to be set in host mode before clamp is removed if the host needs to issue reset after suspend. if this bit is not set, then the host issues resume after suspend. this bit is not applicable in device mode and when em2 is not used. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 physleep 0 r phy in sleep indicates that the phy is in sleep state. 5:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 rstpdwnmodule 0 rw reset power-down modules the application sets this bit to reset the part of the usb that is powered down during em2. the application clears this bit to release reset after an waking up from em2 when the phy clock is back at 48/6 mhz. accessing core registers is possible only when this bit is set to 0. 2 pwrclmp 0 rw power clamp the application sets this bit before the power is turned off to clamp the signals between the power-on modules and the power-off modules of the usb core. the application clears the bit to disable the clamping. 1 gatehclk 0 rw gate hclk the application sets this bit to gate the clock (hclk) to modules other than the ahb slave and master and wakeup logic when the usb is suspended or the session is not valid. the application clears this bit when the usb is resumed or a new session starts. 0 stoppclk 0 rw stop phy clock the application sets this bit to stop the phy clock when the usb is suspended, the session is not valid, or the device is disconnected. the application clears this bit when the usb is resumed or a new session starts. 15.6.69 usb_fifo0dx - device ep 0/host channel 0 fifo this register, available in both host and device modes, is used to read or write the fifo space for endpoint 0 or channel 0, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 403 www.energymicro.com offset bit position 0x3d000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo0d bit name reset access description 31:0 fifo0d 0xxxxxxxxx rw device ep 0/host channel 0 fifo fifo 0 push/pop region. used in slave mode. 15.6.70 usb_fifo1dx - device ep 1/host channel 1 fifo this register, available in both host and device modes, is used to read or write the fifo space for endpoint 1 or channel 1, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel. offset bit position 0x3e000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo1d bit name reset access description 31:0 fifo1d 0xxxxxxxxx rw device ep 1/host channel 1 fifo fifo 1 push/pop region. used in slave mode. 15.6.71 usb_fifo2dx - device ep 2/host channel 2 fifo this register, available in both host and device modes, is used to read or write the fifo space for endpoint 2 or channel 2, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 404 www.energymicro.com offset bit position 0x3f000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo2d bit name reset access description 31:0 fifo2d 0xxxxxxxxx rw device ep 2/host channel 2 fifo fifo 2 push/pop region. used in slave mode. 15.6.72 usb_fifo3dx - device ep 3/host channel 3 fifo this register, available in both host and device modes, is used to read or write the fifo space for endpoint 3 or channel 3, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel. offset bit position 0x40000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo3d bit name reset access description 31:0 fifo3d 0xxxxxxxxx rw device ep 3/host channel 3 fifo fifo 3 push/pop region. used in slave mode. 15.6.73 usb_fifo4dx - device ep 4/host channel 4 fifo this register, available in both host and device modes, is used to read or write the fifo space for endpoint 4 or channel 4, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 405 www.energymicro.com offset bit position 0x41000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo4d bit name reset access description 31:0 fifo4d 0xxxxxxxxx rw device ep 4/host channel 4 fifo fifo 4 push/pop region. used in slave mode. 15.6.74 usb_fifo5dx - device ep 5/host channel 5 fifo this register, available in both host and device modes, is used to read or write the fifo space for endpoint 5 or channel 5, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel. offset bit position 0x42000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo5d bit name reset access description 31:0 fifo5d 0xxxxxxxxx rw device ep 5/host channel 5 fifo fifo 5 push/pop region. used in slave mode. 15.6.75 usb_fifo6dx - device ep 6/host channel 6 fifo this register, available in both host and device modes, is used to read or write the fifo space for endpoint 6 or channel 6, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 406 www.energymicro.com offset bit position 0x43000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo6d bit name reset access description 31:0 fifo6d 0xxxxxxxxx rw device ep 6/host channel 6 fifo fifo 6 push/pop region. used in slave mode. 15.6.76 usb_fifo7dx - host channel 7 fifo this register, available in host mode, is used to read or write the fifo space for channel 7, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel. offset bit position 0x44000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo7d bit name reset access description 31:0 fifo7d 0xxxxxxxxx rw host channel 7 fifo fifo 7 push/pop region. used in slave mode. 15.6.77 usb_fifo8dx - host channel 8 fifo this register, available in host mode, is used to read or write the fifo space for channel 8, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 407 www.energymicro.com offset bit position 0x45000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo8d bit name reset access description 31:0 fifo8d 0xxxxxxxxx rw host channel 8 fifo fifo 8 push/pop region. used in slave mode. 15.6.78 usb_fifo9dx - host channel 9 fifo this register, available in host mode, is used to read or write the fifo space for channel 9, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel. offset bit position 0x46000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo9d bit name reset access description 31:0 fifo9d 0xxxxxxxxx rw host channel 9 fifo fifo 9 push/pop region. used in slave mode. 15.6.79 usb_fifo10dx - host channel 10 fifo this register, available in host mode, is used to read or write the fifo space for channel 10, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 408 www.energymicro.com offset bit position 0x47000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo10d bit name reset access description 31:0 fifo10d 0xxxxxxxxx rw host channel 10 fifo fifo 10 push/pop region. used in slave mode. 15.6.80 usb_fifo11dx - host channel 11 fifo this register, available in host mode, is used to read or write the fifo space for channel 11, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel. offset bit position 0x48000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo11d bit name reset access description 31:0 fifo11d 0xxxxxxxxx rw host channel 11 fifo fifo 11 push/pop region. used in slave mode. 15.6.81 usb_fifo12dx - host channel 12 fifo this register, available in host mode, is used to read or write the fifo space for channel 12, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 409 www.energymicro.com offset bit position 0x49000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo12d bit name reset access description 31:0 fifo12d 0xxxxxxxxx rw host channel 12 fifo fifo 12 push/pop region. used in slave mode. 15.6.82 usb_fifo13dx - host channel 13 fifo this register, available in host mode, is used to read or write the fifo space for channel 13, in a given direction. if a host channel is of type in, the fifo can only be read on the channel. similarly, if a host channel is of type out, the fifo can only be written on the channel. offset bit position 0x4a000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fifo13d bit name reset access description 31:0 fifo13d 0xxxxxxxxx rw host channel 13 fifo fifo 13 push/pop region. used in slave mode.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 410 www.energymicro.com 15.6.83 usb_fiforamx - direct access to data fifo ram for debugging (2 kb) offset bit position 0x5c000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name fiforam bit name reset access description 31:0 fiforam 0xxxxxxxxx rw fifo ram direct access to data fifo ram for debugging (2 kb)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 411 www.energymicro.com 16 i 2 c - inter-integrated circuit interface 0 1 2 3 4 efm32 i 2 c m ast er /slave ot her i 2 c m ast er ot her i 2 c slave v dd i 2 c eeprom sda scl quick facts what? the i 2 c interface allows communication on i 2 c-buses with the lowest energy consumption possible. why? i 2 c is a popular serial bus that enables communication with a number of external devices using only two i/o pins. how? with the help of dma, the i 2 c interface allows i 2 c communication with minimal cpu intervention. address recognition is available in all energy modes (except em4), allowing the mcu to wait for data on the i 2 c-bus with sub-a current consumption. 16.1 introduction the i 2 c module provides an interface between the mcu and a serial i 2 c-bus. it is capable of acting as both master and slave, and supports multi-master buses. standard-mode, fast-mode and fast-mode plus speeds are supported, allowing transmission rates all the way from 10 kbit/s up to 1 mbit/s. slave arbitration and timeouts are also provided to allow implementation of an smbus compliant system. the interface provided to software by the i 2 c module allows both fine-grained control of the transmission process and close to automatic transfers. automatic recognition of slave addresses is provided in all energy modes (except em4). 16.2 features ? true multi-master capability ? support for different bus speeds ? standard-mode (sm) bit rate up to 100 kbit/s ? fast-mode (fm) bit rate up to 400 kbit/s ? fast-mode plus (fm+) bit rate up to 1 mbit/s ? arbitration for both master and slave (allows smbus arp) ? clock synchronization and clock stretching ? hardware address recognition ? 7-bit masked address ? general call address ? active in all energy modes (except em4) ? 10-bit address support ? error handling ? clock low timeout ? clock high timeout ? arbitration lost ? bus error detection ? double buffered data ? full dma support
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 412 www.energymicro.com 16.3 functional description an overview of the i 2 c module is shown in figure 16.1 (p. 412 ) . figure 16.1. i 2 c overview transm it buffer transm it shift regist er i2cn_sda receive buffer receive shift regist er i 2 c cont rol and st at us peripheral bus i2cn_scl pin ct rl sym bol generat or receive cont roller clock generat or address recognizer 16.3.1 i 2 c-bus overview the i 2 c-bus uses two wires for communication; a serial data line (sda) and a serial clock line (scl) as shown in figure 16.2 (p. 412 ) . as a true multi-master bus it includes collision detection and arbitration to resolve situations where multiple masters transmit data at the same time without data loss. figure 16.2. i 2 c-bus example i 2 c m ast er # 1 i 2 c m ast er # 2 i 2 c slave # 1 i 2 c slave # 2 i 2 c slave # 3 sda scl v dd r p each device on the bus is addressable by a unique address, and an i 2 c master can address all the devices on the bus, including other masters. both the bus lines are open-drain. the maximum value of the pull-up resistor can be calculated as a function of the maximal rise-time tr for the given bus speed, and the estimated bus capacitance cb as shown in equation 16.1 (p. 412 ) . i 2 c pull-up resistor equation rp(max) = (tr/0.8473) x cb . (16.1) the maximal rise times for 100 khz, 400 khz and 1 mhz i 2 c are 1 s, 300 ns and 120 ns respectively. note
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 413 www.energymicro.com the gpio drive strength can be used to control slew rate. note if v dd drops below the voltage on scl and sda lines, the mcu could become back powered and pull the scl and sda lines low. 16.3.1.1 start and stop conditions start and stop conditions are used to initiate and stop transactions on the i 2 c-bus. all transactions on the bus begin with a start condition (s) and end with a stop condition (p). as shown in figure 16.3 (p. 413 ) , a start condition is generated by pulling the sda line low while scl is high, and a stop condition is generated by pulling the sda line high while scl is high. figure 16.3. i 2 c start and stop conditions scl sda s p start condit ion stop condit ion the start and stop conditions are easily identifiable bus events as they are the only conditions on the bus where a transition is allowed on sda while scl is high. during the actual data transmission, sda is only allowed to change while scl is low, and must be stable while scl is high. one bit is transferred per clock pulse on the i 2 c-bus as shown in figure 16.2 (p. 412 ) . figure 16.4. i 2 c bit transfer on i 2 c-bus scl sda dat a st able dat a change allowed dat a change allowed 16.3.1.2 bus transfer when a master wants to initiate a transfer on the bus, it waits until the bus is idle and transmits a start condition on the bus. the master then transmits the address of the slave it wishes to interact with and a single r/w bit telling whether it wishes to read from the slave (r/w bit set to 1) or write to the slave (r/w bit set to 0). after the 7-bit address and the r/w bit, the master releases the bus, allowing the slave to acknowledge the request. during the next bit-period, the slave pulls sda low (ack) if it acknowledges the request, or keeps it high if it does not acknowledge it (nack). following the address acknowledge, either the slave or master transmits data, depending on the value of the r/w bit. after every 8 bits (one byte) transmitted on the sda line, the transmitter releases the line to allow the receiver to transmit an ack or a nack. both the data and the address are transmitted with the most significant bit first. the number of bytes in a bus transfer is unrestricted. the master ends the transmission after a (n)ack by sending a stop condition on the bus. after a stop condition, any master wishing to initiate a transfer
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 414 www.energymicro.com on the bus can try to gain control of it. if the current master wishes to make another transfer immediately after the current, it can start a new transfer directly by transmitting a repeated start condition (sr) instead of a stop followed by a start. examples of i 2 c transfers are shown in figure 16.5 (p. 414 ) , figure 16.6 (p. 414 ) , and figure 16.7 (p. 414 ) . the identifiers used are: ? addr - address ? data - data ? s - start bit ? sr - repeated start bit ? p - stop bit ? w/r - read(1)/write(0) ? a - ack ? n - nack figure 16.5. i 2 c single byte write to slave w s addr data a a p figure 16.6. i 2 c double byte read from slave r s addr data a data n a p figure 16.7. i 2 c single byte write, then repeated start and single byte read r sr addr data a n p w s addr data a a 16.3.1.3 addresses i 2 c supports both 7-bit and 10-bit addresses. when using 7-bit addresses, the first byte transmitted after the start-condition contains the address of the slave that the master wants to contact. in the 7-bit address space, several addresses are reserved. these addresses are summarized in table 16.1 (p. 414 ) , and include a general call address which can be used to broadcast a message to all slaves on the i 2 c-bus. table 16.1. i 2 c reserved i 2 c addresses i 2 c address r/w description 0000-000 0 general call address 0000-000 1 start byte 0000-001 x reserved for the c-bus format 0000-010 x reserved for a different bus format 0000-011 x reserved for future purposes 0000-1xx x reserved for future purposes 1111-1xx x reserved for future purposes 1111-0xx x 10 bit slave addressing mode 16.3.1.4 10-bit addressing to address a slave using a 10-bit address, two bytes are required to specify the address instead of one. the seven first bits of the first byte must then be 1111 0xx, where xx are the two most significant bits of the 10-bit address. as with 7-bit addresses, the eight bit of the first byte determines whether the
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 415 www.energymicro.com master wishes to read from or write to the slave. the second byte contains the eight least significant bits of the slave address. when a slave receives a 10-bit address, it must acknowledge both the address bytes if they match the address of the slave. when performing a master transmitter operation, the master transmits the two address bytes and then the remaining data, as shown in figure 16.8 (p. 415 ) . figure 16.8. i 2 c master transmitter/slave receiver with 10-bit address w s a a data a p addr (2nd byt e) addr (1st 7 bit s) when performing a master receiver operation however, the master first transmits the two address bytes in a master transmitter operation, then sends a repeated start followed by the first address byte and then receives data from the addressed slave. the slave addressed by the 10-bit address in the first two address bytes must remember that it was addressed, and respond with data if the address transmitted after the repeated start matches its own address. an example of this (with one byte transmitted) is shown in figure 16.9 (p. 415 ) . figure 16.9. i 2 c master receiver/slave transmitter with 10-bit address r sr data a n p w s a a addr (1st 7 bit s) addr (2nd byt e) addr (1st 7 bit s) 16.3.1.5 arbitration, clock synchronization, clock stretching arbitration and clock synchronization are features aimed at allowing multi-master buses. arbitration occurs when two devices try to drive the bus at the same time. if one device drives it low, while the other drives it high, the one attempting to drive it high will not be able to do so due to the open-drain bus configuration. both devices sample the bus, and the one that was unable to drive the bus in the desired direction detects the collision and backs off, letting the other device continue communication on the bus undisturbed. clock synchronization is a means of synchronizing the clock outputs from several masters driving the bus at once, and is a requirement for effective arbitration. slaves on the bus are allowed to force the clock output on the bus low in order to pause the communication on the bus and give themselves time to process data or perform any real-time tasks they might have. this is called clock stretching. arbitration is supported by the i 2 c module for both masters and slaves. clock synchronization and clock stretching is also supported. 16.3.2 enable and reset the i 2 c is enabled by setting the en bit in the i2cn_ctrl register. whenever this bit is cleared, the internal state of the i 2 c is reset, terminating any ongoing transfers. note when re-enabling the i 2 c, the abort command or the bus idle timeout feature must be applied prior to use even if the busy flag is not set. 16.3.3 safely disabling and changing slave configuration the i 2 c slave is partially asynchronous, and some precautions are necessary to always ensure a safe slave disable or slave configuration change. these measures should be taken, if (while the slave is enabled) the user cannot guarantee that an address match will not occur at the exact time of slave disable or slave configuration change.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 416 www.energymicro.com worst case consequences for an address match while disabling slave or changing configuration is that the slave may end up in an undefined state. to reset the slave back to a known state, the en bit in i2cn_ctrl must be reset. this should be done regardless of whether the slave is going to be re-enabled or not. 16.3.4 clock generation the scl signal generated by the i 2 c master determines the maximum transmission rate on the bus. the clock is generated as a division of the peripheral clock, and is given by equation 16.2 (p. 416 ) : i 2 c maximum transmission rate f scl = f hfperclk /(((n low + n high ) x (div + 1)) + 4) , (16.2) n low and n high specify the number of prescaled clock cycles in the low and high periods of the clock signal respectively. the worst case low and high periods of the signal are: i 2 c high and low cycles equations t high >= (n high x (div + 1) + 3)/f hfperclk , t low >= (n low x (div + 1) + 3)/f hfperclk . (16.3) the values of n low and n high and thus the ratio between the high and low parts of the clock signal is controlled by clhr in the i2cn_ctrl register. the available modes are summarized in table 16.2 (p. 416 ) along with the highest i 2 c-bus frequencies in the given modes that can be achieved without violating the timing specifications of the i 2 c-bus. the frequencies are calculated taking the maximum allowed rise and fall times of sda and scl into account. higher frequencies may be achieved in practice. the 3 extra cycles are synchronization, and must be taken into consideration when div in the i2cn_clkdiv register has a low value. note div must be 1 or higher when the slave is enabled. table 16.2. i 2 c clock mode examples mode clkdiv clhr scl high cycles / scl low cycles sm max frequency fm max frequency fm+ max frequency standard 0 0 7:7 93 khz 312 khz 806 khz asymmetric 0 1 9:6 88 khz 361 khz 931 khz fast 0 2 14:9 86 khz 365 khz 942 khz standard 1 0 11:11 93 khz 312 khz 806 khz asymmetric 1 1 15:9 83 khz 373 khz 961 khz fast 1 2 25:15 83 khz 373 khz 961 khz standard 2 0 15:15 93 khz 312 khz 806 khz asymmetric 2 1 21:12 81 khz 378 khz 974 khz fast 2 2 36:21 82 khz 376 khz 969 khz 16.3.5 arbitration arbitration is enabled by default, but can be disabled by setting the arbdis bit in i2cn_ctrl. when arbitration is enabled, the value on sda is sensed every time the i 2 c module attempts to change its value. if the sensed value is different than the value the i 2 c module tried to output, it is interpreted as a simultaneous transmission by another device, and that the i 2 c module has lost arbitration.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 417 www.energymicro.com whenever arbitration is lost, the arblost interrupt flag in i2cn_if is set, any lines held are released, and the i 2 c device goes idle. if an i 2 c master loses arbitration during the transmission of an address, another master may be trying to address it. the master therefore receives the rest of the address, and if the address matches the slave address of the master, the master goes into either slave transmitter or slave receiver mode. note arbitration can be lost both when operating as a master and when operating as a slave. 16.3.6 buffers 16.3.6.1 transmit buffer and shift register the i 2 c transmitter is double buffered through the transmit buffer and transmit shift register as shown in figure 16.1 (p. 412 ) . a byte is loaded into the transmit buffer by writing to i2cn_txdata. when the transmit shift register is empty and ready for new data, the byte from the transmit buffer is then loaded into the shift register. the byte is then kept in the shift register until it is transmitted. when a byte has been transmitted, a new byte is loaded into the shift register (if available in the transmit buffer). if the transmit buffer is empty, then the shift register also remains empty. the txc flag in i2cn_status and the txc interrupt flags in i2cn_if are then set, signaling that the transmit shift register is out of data. txc is cleared when new data becomes available, but the txc interrupt flag must be cleared by software. whenever a byte is loaded from the transmit buffer to the transmit shift register, the txbl flag in i2cn_status and the txbl interrupt flag in i2cn_if are set. this indicates that there is room in the buffer for more data. txbl is cleared automatically when data is written to the buffer. if a write is attempted to the transmit buffer while it is not empty, the txof interrupt flag in i2cn_if is set, indicating the overflow. the data already in the buffer remains preserved, and no new data is written. the transmit buffer and the transmit shift register can be cleared by setting command bit cleartx in i2cn_cmd. this will prevent the i 2 c module from transmitting the data in the buffer and the shift register, and will make them available for new data. any byte currently being transmitted will not be aborted. transmission of this byte will be completed. 16.3.6.2 receive buffer and shift register like the transmitter, the i 2 c receiver is double buffered. the receiver uses the receive buffer and receive shift register as shown in figure 16.1 (p. 412 ) . when a byte has been fully received by the receive shift register, it is loaded into the receive buffer if there is room for it. otherwise, the byte waits in the shift register until space becomes available in the buffer. when a byte becomes available in the receive buffer, the rxdatav in i2cn_status and rxdatav interrupt flag in i2cn_if are set. the data can now be fetched from the buffer using i2cn_rxdata. reading from this register will pull a byte out of the buffer, making room for a new byte and clearing rxdatav in i2cn_status and rxdatav in i2cn_if in the process. if a read from the receive buffer is attempted through i2cn_rxdata while the buffer is empty, the rxuf interrupt flag in i2cn_if is set, and the data read from the buffer is undefined. i2cn_rxdatap can be used to read data from the receive buffer without removing it from the buffer. the rxuf interrupt flag in i2cn_if will never be set as a result of reading from i2cn_rxdatap, but the data read through i2cn_rxdatap when the receive buffer is empty is still undefined. 16.3.7 master operation a bus transaction is initiated by transmitting a start condition (s) on the bus. this is done by setting the start bit in i2cn_cmd. the command schedules a start condition, and makes the i 2 c module generate a start condition whenever the bus becomes free.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 418 www.energymicro.com the i 2 c-bus is considered busy whenever another device on the bus transmits a start condition. until a stop condition is detected, the bus is owned by the master issuing the start condition. the bus is considered free when a stop condition is transmitted on the bus. after a stop is detected, all masters that have data to transmit send a start condition and begin transmitting data. arbitration ensures that collisions are avoided. when the start condition has been transmitted, the master must transmit a slave address (addr) with an r/w bit on the bus. if this address is available in the transmit buffer, the master transmits it immediately, but if the buffer is empty, the master holds the i 2 c-bus while waiting for software to write the address to the transmit buffer. after the address has been transmitted, a sequence of bytes can be read from or written to the slave, depending on the value of the r/w bit (bit 0 in the address byte). if the bit was cleared, the master has entered a master transmitter role, where it now transmits data to the slave. if the bit was set, it has entered a master receiver role, where it now should receive data from the slave. in either case, an unlimited number of bytes can be transferred in one direction during the transmission. at the end of the transmission, the master either transmits a repeated start condition (sr) if it wishes to continue with another transfer, or transmits a stop condition (p) if it wishes to release the bus. 16.3.7.1 master state machine the master state machine is shown in figure 16.10 (p. 419 ) . a master operation starts in the far left of the state machine, and follows the solid lines through the state machine, ending the operation or continuing with a new operation when arriving at the right side of the state machine. branches in the path through the state machine are the results of bus events and choices made by software, either directly or indirectly. the dotted lines show where i 2 c-specific interrupt flags are set along the path and the full-drawn circles show places where interaction may be required by software to let the transmission proceed.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 419 www.energymicro.com figure 16.10. i 2 c master state machine wait ing for idle idle/busy 57 b3 9b 0 57 s addr r a n addr w a n data p sr x arb. lost 1 97 d7 df 9f a n a n data p sr arb. lost addr r arb. lost , addr m at ch addr w arb. lost , addr m at ch addr x arb. lost , no m at ch 1 71 mast er receiver mast er t ransm it t er arbit rat ion lost slave t ransm it t er slave receiver 0 57 1 93 0/1 bus st at e/event transm it t ed by self received from slave start condit ion int errupt flag set int eract ion required. wait - st at es insert ed unt il m anual or aut om at ic int eract ion has been perform ed go t o st at e a s p n sr ack stop condit ion nack repeat ed start condit ion addr r addr w slave address + read ( r/w bit set ) slave address + writ e ( r/w bit cleared) bus st at e (state) 73 0 p bus reset 16.3.7.2 interactions whenever the i 2 c module is waiting for interaction from software, it holds the bus clock scl low, freezing all bus activities, and the bushold interrupt flag in i2cn_if is set. the action(s) required by software depends on the current state the of the i 2 c module. this state can be read from the i2cn_state register. as an example, table 16.4 (p. 422 ) shows the different states the i 2 c goes through when operating as a master transmitter, i.e. a master that transmits data to a slave. as seen in the table, when a start condition has been transmitted, a requirement is that there is an address and an r/w bit in the transmit buffer. if the transmit buffer is empty, then the bushold interrupt flag is set, and the bus is held until data becomes available in the buffer. while waiting for the address, i2cn_state has a value 0x57, which can be used to identify exactly what the i 2 c module is waiting for. note the bus would never stop at state 0x57 if the address was available in the transmit buffer. the different interactions used by the i 2 c module are listed in table 16.3 (p. 420 ) in prioritized order. if a set of different courses of action are possible from a given state, the course of action using the highest priority interactions, that first has everything it is waiting for is the one that is taken.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 420 www.energymicro.com table 16.3. i 2 c interactions in prioritized order interaction priority software action automatically continues if stop* 1 set the stop command bit in i2cn_cmd pstop is set (stop pending) in i2cn_status abort 2 set the abort command bit in i2cn_cmd never, the transmission is aborted cont* 3 set the cont command bit in i2cn_cmd pcont is set in i2cn_status (cont pending) nack* 4 set the nack command bit in i2cn_cmd pnack is set in i2cn_status (nack pending) ack* 5 set the ack command bit in i2cn_cmd autoack is set in i2cn_ctrl or pack is set in i2cn_status (ack pending) addr+w -> txdata 6 write an address to the transmit buffer with the r/w bit set address is available in transmit buffer with r/w bit set addr+r -> txdata 7 write an address to the transmit buffer with the r/w bit cleared address is available in transmit buffer with r/w bit cleared start* 8 set the start command bit in i2cn_cmd pstart is set in i2cn_status (start pending) txdata 9 write data to the transmit buffer data is available in transmit buffer rxdata 10 read data from receive buffer space is available in receive buffer none 11 no interaction is required the commands marked with a * in table 16.3 (p. 420 ) can be issued before an interaction is required. when such a command is issued before it can be used/consumed by the i 2 c module, the command is set in a pending state, which can be read from the status register. a pending start command can for instance be identified by pstart having a high value. whenever the i 2 c module requires an interaction, it checks the pending commands. if one or a combination of these can fulfill an interaction, they are consumed by the module and the transmission continues without setting the bushold interrupt flag in i2cn_if to get an interaction from software. the pending status of a command goes low when it is consumed. when several interactions are possible from a set of pending commands, the interaction with the highest priority, i.e. the interaction closest to the top of table 16.3 (p. 420 ) is applied to the bus. pending commands can be cleared by setting the clearpc command bit in i2cn_cmd. 16.3.7.2.1 automatic ack interaction when receiving addresses and data, an ack command in i2cn_cmd is normally required after each received byte. when autoack is set in i2cn_ctrl, an ack is always pending, and the ack-pending bit pack in i2cn_status is thus always set, even after an ack has been consumed. this can be used to reduce the amount of software interaction required during a transfer.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 421 www.energymicro.com 16.3.7.3 reset state after a reset, the state of the i 2 c-bus is unknown. to avoid interrupting transfers on the i 2 c-bus after a reset of the i 2 c module or the entire mcu, the i 2 c-bus is assumed to be busy when coming out of a reset, and the busy flag in i2cn_status is thus set. to be able to carry through master operations on the i 2 c-bus, the bus must be idle. the bus goes idle when a stop condition is detected on the bus, but on buses with little activity, the time before the i 2 c module detects that the bus is idle can be significant. there are two ways of assuring that the i 2 c module gets out of the busy state. ? use the abort command in i2cn_cmd. when the abort command is issued, the i 2 c module is instructed that the bus is idle. the i 2 c module can then initiate master operations. ? use the bus idle timeout. when scl has been high for a long period of time, it is very likely that the bus is idle. set bito in i2cn_ctrl to an appropriate timeout period and set gibito in i2cn_ctrl. if activity has not been detected on the bus within the timeout period, the bus is then automatically assumed idle, and master operations can be initiated. note if operating in slave mode, the above approach is not necessary. 16.3.7.4 master transmitter to transmit data to a slave, the master must operate as a master transmitter. table 16.4 (p. 422 ) shows the states the i 2 c module goes through while acting as a master transmitter. every state where an interaction is required has the possible interactions listed, along with the result of the interactions. the table also shows which interrupt flags are set in the different states. the interrupt flags enclosed in parenthesis may be set. if the bushold interrupt in i2cn_if is set, the module is waiting for an interaction, and the bus is frozen. the value of i2cn_state will be equal to the values given in the table when the bushold interrupt flag is set, and can be used to determine which interaction is required to make the transmission continue. the interrupt flag start in i2cn_if is set when the i 2 c module transmits the start. a master operation is started by issuing a start command by setting start in i2cn_cmd. addr +w, i.e. the address of the slave to address + the r/w bit is then required by the i 2 c module. if this is not available in the transmit buffer, then the bus is held and the bushold interrupt flag is set. the value of i2cn_state will then be 0x57. as seen in the table, the i 2 c module also stops in this state if the address is not available after a repeated start condition. to continue, write a byte to i2cn_txdata with the address of the slave in the 7 most significant bits and the least significant bit cleared (addr+w). this address will then be transmitted, and the slave will reply with an ack or a nack. if no slave replies to the address, the response will also be nack. if the address was acknowledged, the master now has four choices. if another byte is made available in i2cn_txdata, this byte is transmitted. the master can also stop the transmission by sending a stop, it can send a repeated start by sending start, or it can send a stop and then a start as soon as possible. if a nack was received, the master has to issue a cont command in addition to providing data in order to continue transmission. this is not standard i 2 c, but is provided for flexibility. the rest of the options are similar to when an ack was received. if a new byte was transmitted, an ack or nack is received after the transmission of the byte, and the master has the same options as for when the address was sent. the master may lose arbitration at any time during transmission. in this case, the arblost interrupt flag in i2cn_if is set. if the arbitration was lost during the transfer of an address, and slave in i2cn_ctrl
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 422 www.energymicro.com is set, the master then checks which address was transmitted. if it was the address of the master, then the master goes to slave mode. after a master has transmitted a start and won any arbitration, it owns the bus until it transmits a stop. after a stop, the bus is released, and arbitration decides which bus master gains the bus next. the mstop interrupt flag in i2cn_if is set when a stop condition is transmitted by the master. table 16.4. i 2 c master transmitter i2cn_state description i2cn_if required interaction response addr +w -> txdata addr+w will be sent stop stop will be sent and bus released. 0x57 start transmitted start interrupt flag (bushold interrupt flag) stop + start stop will be sent and bus released. then a start will be sent when bus becomes idle. addr +w -> txdata addr+w will be sent stop stop will be sent and bus released. 0x57 repeated start transmitted start interrupt flag (bushold interrupt flag) stop + start stop will be sent and bus released. then a start will be sent when bus becomes idle. - addr+w transmitted txbl interrupt flag (txc interrupt flag) none txdata data will be sent stop stop will be sent. bus will be released start repeated start condition will be sent 0x97 addr+w transmitted, ack received ack interrupt flag (bushold interrupt flag) stop + start stop will be sent and the bus released. then a start will be sent when the bus becomes idle cont + txdata data will be sent stop stop will be sent. bus will be released start repeated start condition will be sent 0x9f addr+w transmitted,nack received nack (bushold interrupt flag) stop + start stop will be sent and the bus released. then a start will be sent when the bus becomes idle - data transmitted txbl interrupt flag (txc interrupt flag) none txdata data will be sent stop stop will be sent. bus will be released start repeated start condition will be sent 0xd7 data transmitted,ack received ack interrupt flag (bushold interrupt flag) stop + start stop will be sent and the bus released. then a start will be sent when the bus becomes idle cont + txdata data will be sent 0xdf data transmitted,nack received nack(bushold interrupt flag) stop stop will be sent. bus will be released
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 423 www.energymicro.com i2cn_state description i2cn_if required interaction response start repeated start condition will be sent stop + start stop will be sent and the bus released. then a start will be sent when the bus becomes idle none - stop transmitted mstop interrupt flag start start will be sent when bus becomes idle none - arbitration lost arblost interrupt flag start start will be sent when bus becomes idle 16.3.7.5 master receiver to receive data from a slave, the master must operate as a master receiver, see table 16.5 (p. 423 ) . this is done by transmitting addr+r as the address byte instead of addr+w, which is transmitted to become a master transmitter. the address byte loaded into the data register thus has to contain the 7- bit slave address in the 7 most significant bits of the byte, and have the least significant bit set. when the address has been transmitted, the master receives an ack or a nack. if an ack is received, the ack interrupt flag in i2cn_if is set, and if space is available in the receive shift register, reception of a byte from the slave begins. if the receive buffer and shift register is full however, the bus is held until data is read from the receive buffer or another interaction is made. note that the stop and start interactions have a higher priority than the data-available interaction, so if a stop or start command is pending, the highest priority interaction will be performed, and data will not be received from the slave. if a nack was received, the cont command in i2cn_cmd has to be issued in order to continue receiving data, even if there is space available in the receive buffer and/or shift register. after a data byte has been received the master must ack or nack the received byte. if an ack is pending or autoack in i2cn_ctrl is set, an ack is sent automatically and reception continues if space is available in the receive buffer. if a nack is sent, the cont command must be used in order to continue transmission. if an ack or nack is issued along with a start or stop or both, then the ack/nack is transmitted and the reception is ended. if start in i2cn_cmd is set alone, a repeated start condition is transmitted after the ack/nack. if stop in i2cn_cmd is set, a stop condition is sent regardless of whether start is set. if start is set in this case, it is set as pending. as when operating as a master transmitter, arbitration can be lost as a master receiver. when this happens the arblost interrupt flag in i2cn_if is set, and the master has a possibility of being selected as a slave given the correct conditions. table 16.5. i 2 c master receiver i2cn_state description i2cn_if required interaction response addr +r -> txdata addr+r will be sent stop stop will be sent and bus released. 0x57 start transmitted start interrupt flag (bushold interrupt flag) stop + start stop will be sent and bus released. then a start will be sent when bus becomes idle. 0x57 repeated start transmitted start interrupt flag(bushold interrupt flag) addr +r -> txdata addr+r will be sent
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 424 www.energymicro.com i2cn_state description i2cn_if required interaction response stop stop will be sent and bus released. stop + start stop will be sent and bus released. then a start will be sent when bus becomes idle. - addr+r transmitted txbl interrupt flag (txc interrupt flag) none rxdata start receiving stop stop will be sent and the bus released start repeated start will be sent 0x93 addr+r transmitted, ack received ack interrupt flag(bushold) stop + start stop will be sent and the bus released. then a start will be sent when the bus becomes idle cont + rxdata continue, start receiving stop stop will be sent and the bus released start repeated start will be sent 0x9b addr+r transmitted,nack received nack(bushold) stop + start stop will be sent and the bus released. then a start will be sent when the bus becomes idle ack + rxdata ack will be transmitted, reception continues nack + cont + rxdata nack will be transmitted, reception continues ack/ nack + stop ack/nack will be sent and the bus will be released. ack/ nack + start ack/nack will be sent, and then a repeated start condition. 0xb3 data received rxdata interrupt flag(bushold interrupt flag) ack/ nack + stop + start ack/nack will be sent and the bus will be released. then a start will be sent when the bus becomes idle none - stop received mstop interrupt flag start start will be sent when bus becomes idle none - arbitration lost arblost interrupt flag start start will be sent when bus becomes idle 16.3.8 bus states the i2cn_state register can be used to determine which state the i 2 c module and the i 2 c bus are in at a given time. the register consists of the state bit-field, which shows which state the i 2 c module is at in any ongoing transmission, and a set of single-bits, which reveal the transmission mode, whether the bus is busy or idle, and whether the bus is held by this i 2 c module waiting for a software response. the possible values of the state field are summarized in table 16.6 (p. 425 ) . when this field is cleared, the i 2 c module is not a part of any ongoing transmission. the remaining status bits in the i2cn_state register are listed in table 16.7 (p. 425 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 425 www.energymicro.com table 16.6. i 2 c state values mode value description idle 0 no transmission is being performed by this module. wait 1 waiting for idle. will send a start condition as soon as the bus is idle. start 2 start being transmitted addr 3 address being transmitted or has been received addrack 4 address ack/nack being transmitted or received data 5 data being transmitted or received dataack 6 data ack/nack being transmitted or received table 16.7. i 2 c transmission status bit description busy set whenever there is activity on the bus. whether or not this module is responsible for the activity cannot be determined by this byte. master set when operating as a master. cleared at all other times. transmitter set when operating as a transmitter; either a master transmitter or a slave transmitter. cleared at all other times bushold set when the bus is held by this i 2 c module because an action is required by software. nack only valid when bus is held and state is addrack or dataack. in that case it is set if a nack was received. in all other cases, the bit is cleared. note i2cn_state reflects the internal state of the i 2 c module, and therefore only held constant as long as the bus is held, i.e. as long as bushold in i2cn_status is set. 16.3.9 slave operation the i 2 c module operates in master mode by default. to enable slave operation, i.e. to allow the device to be addressed as an i 2 c slave, the slave bit in i2cn_ctrl must be set. in this case the slave operates in a mixed mode, both capable of starting transmissions as a master, and being addressed as a slave. 16.3.9.1 slave state machine the slave state machine is shown in figure 16.11 (p. 426 ) . the dotted lines show where i 2 c-specific interrupt flags are set. the full-drawn circles show places where interaction may be required by software to let the transmission proceed.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 426 www.energymicro.com figure 16.11. i 2 c slave state machine 73 d5 dd 0 41 s addr r a n addr w a n data p sr arb. lost 1 71 b1 0 41 a n a n data p sr slave t ransm it t er slave receiver x arb. lost 1 idle/busy 0/1 bus st at e/event transm it t ed by self received from m ast er bus st at e (state) int errupt flag set int eract ion required. clock- st ret ching applied unt il m anual or aut om at ic int eract ion has been perform ed go t o st at e 16.3.9.2 address recognition the i 2 c module provides automatic address recognition for 7-bit addresses. 10-bit address recognition is not fully automatic, but can be assisted by the 7-bit address comparator as shown in section 16.3.11 (p. 430 ) . address recognition is supported in all energy modes (except em4). the slave address, i.e. the address which the i 2 c module should be addressed with, is defined in the i2cn_saddr register. in addition to the address, a mask must be specified, telling the address comparator which bits of an incoming address to compare with the address defined in i2cn_saddr. the mask is defined in i2cn_saddrmask, and for every zero in the mask, the corresponding bit in the slave address is treated as a don?t-care. an incoming address that fails address recognition is automatically replied to with a nack. since only the bits defined by the mask are checked, a mask with a value 0x00 will result in all addresses being accepted. a mask with a value 0x7f will only match the exact address defined in i2cn_saddr, while a mask 0x70 will match all addresses where the three most significant bits in i2cn_saddr and the incoming address are equal. if gcamen in i2cn_ctrl is set, the general call address is always accepted regardless of the result of the address recognition. the start-byte, i.e. the general call address with the r/w bit set is ignored unless it is included in the defined slave address. when an address is accepted by the address comparator, the decision of whether to ack or nack the address is passed to software. 16.3.9.3 slave transmitter when slave in i2cn_ctrl is set, the rstart interrupt flag in i2cn_if will be set when repeated start conditions are detected. no interaction is required on this event however. after a start or repeated start condition, the bus master will transmit an address along with an r/ w bit. if there is no room in the receive shift register for the address, the bus will be held by the slave
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 427 www.energymicro.com until room is available in the shift register. transmission then continues and the address is loaded into the shift register. if this address does not pass address recognition, it is automatically nack?ed by the slave, and the slave goes to an idle state. the address byte is in this case discarded, making the shift register ready for a new address. it is not loaded into the receive buffer. if the address was accepted and the r/w bit was set (r), indicating that the master wishes to read from the slave, the slave now goes into the slave transmitter mode. software interaction is now required to decide whether the slave wants to acknowledge the request or not. the accepted address byte is loaded into the receive buffer like a regular data byte. if no valid interaction is pending, the bus is held until the slave responds with a command. the slave can reject the request with a single nack command. the slave will in that case go to an idle state, and wait for the next start condition. to continue the transmission, the slave must make sure data is loaded into the transmit buffer and send an ack. the loaded data will then be transmitted to the master, and an ack or nack will be received from the master. data transmission can also continue after a nack if a cont command is issued along with the nack. this is not standard i 2 c however. if the master responds with an ack, it may expect another byte of data, and data should be made available in the transmit buffer. if data is not available, the bus is held until data is available. if the response is a nack however, this is an indication of that the master has received enough bytes and wishes to end the transmission. the slave now automatically goes idle, unless cont in i2cn_cmd is set and data is available for transmission. the latter is not standard i 2 c. the master ends the transmission by sending a stop or a repeated start. the sstop interrupt flag in i2cn_if is set when the master transmits a stop condition. if the transmission is ended with a repeated start, then the sstop interrupt flag is not set. note the sstop interrupt flag in i2cn_if will be set regardless of whether the slave is participating in the transmission or not, as long as slave in i2cn_ctrl is set and a stop condition is detected if arbitration is lost at any time during transmission, the arblost interrupt flag in i2cn_if is set, the bus is released and the slave goes idle. see table 16.8 (p. 428 ) for more information.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 428 www.energymicro.com table 16.8. i 2 c slave transmitter i2cn_state description i2cn_if required interaction response 0x41 repeated start received rstart interrupt flag (bushold interrupt flag) rxdata receive and compare address addr interrupt flag ack + txdata ack will be sent, then data rxdata interrupt flag nack nack will be sent, slave goes idle 0x73 addr + r received (bushold interrupt flag) nack + cont + txdata nack will be sent, then data. - data transmitted txbl interrupt flag (txc interrupt flag) none 0xd5 data transmitted, ack received ack interrupt flag (bushold interrupt flag) txdata data will be transmitted nack interrupt flag none the slave goes idle 0xdd data transmitted, nack received (bushold interrupt flag) cont + txdata data will be transmitted none the slave goes idle - stop received sstop interrupt flag start start will be sent when bus becomes idle none the slave goes idle - arbitration lost arblost interrupt flag start start will be sent when the bus becomes idle 16.3.9.4 slave receiver a slave receiver operation is started in the same way as a slave transmitter operation, with the exception that the address transmitted by the master has the r/w bit cleared (w), indicating that the master wishes to write to the slave. the slave then goes into slave receiver mode. to receive data from the master, the slave should respond to the address with an ack and make sure space is available in the receive buffer. transmission will then continue, and the slave will receive a byte from the master. if a nack is sent without a cont, the transmission is ended for the slave, and it goes idle. if the slave issues both the nack and cont commands and has space available in the receive buffer, it will be open for continuing reception from the master. when a byte has been received from the master, the slave must ack or nack the byte. the responses here are the same as for the reception of the address byte. the master ends the transmission by sending a stop or a repeated start. the sstop interrupt flag is set when the master transmits a stop condition. if the transmission is ended with a repeated start, then the sstop interrupt flag in i2cn_if is not set. note the sstop interrupt flag in i2cn_if will be set regardless of whether the slave is participating in the transmission or not, as long as slave in i2cn_ctrl is set and a stop condition is detected if arbitration is lost at any time during transmission, the arblost interrupt flag in i2cn_if is set, the bus is released and the slave goes idle.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 429 www.energymicro.com see table 16.9 (p. 429 ) for more information. table 16.9. i 2 c - slave receiver i2cn_state description i2cn_if required interaction response - repeated start received rstart interrupt flag (bushold interrupt flag) rxdata receive and compare address ack + rxdata ack will be sent and data will be received nack nack will be sent, slave goes idle 0x71 addr + w received addr interrupt flag rxdata interrupt flag (bushold interrupt flag) nack + cont + rxdata nack will be sent and data will be received. ack + rxdata ack will be sent and data will be received nack nack will be sent and slave will go idle 0xb1 data received rxdata interrupt flag (bushold interrupt flag) nack + cont + rxdata nack will be sent and data will be received none the slave goes idle - stop received sstop interrupt flag start start will be sent when bus becomes idle none the slave goes idle - arbitration lost arblost interrupt flag start start will be sent when the bus becomes idle 16.3.10 transfer automation the i 2 c can be set up to complete transfers with a minimal amount of interaction. 16.3.10.1 dma dma can be used to automatically load data into the transmit buffer and load data out from the receive buffer. when using dma, software is thus relieved of moving data to and from memory after each transferred byte. 16.3.10.2 automatic ack when autoack in i2cn_ctrl is set, an ack is sent automatically whenever an ack interaction is possible and no higher priority interactions are pending. 16.3.10.3 automatic stop a stop can be generated automatically on two conditions. these apply only to the master transmitter. if autosn in i2cn_ctrl is set, the i 2 c module ends a transmission by transmitting a stop condition when operating as a master transmitter and a nack is received. if autose in i2cn_ctrl is set, the i 2 c module always ends a transmission when there is no more data in the transmit buffer. if data has been transmitted on the bus, the transmission is ended after the (n)ack has been received by the slave. if a start is sent when no data is available in the transmit buffer and autose is set, then the stop condition is sent immediately following the start. software must thus make sure data is available in the transmit buffer before the start condition has been fully transmitted if data is to be transferred.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 430 www.energymicro.com 16.3.11 using 10-bit addresses when using 10-bit addresses in slave mode, set the i2cn_saddr register to 1111 0xx where xx are the two most significant bits of the 10-bit address, and set i2cn_saddrmask to 0xff. address matches will now be given on all 10-bit addresses where the two most significant bits are correct. when receiving an address match, the slave must acknowledge the address and receive the first data byte. this byte contains the second part of the 10-bit address. if it matches the address of the slave, the slave should ack the byte to continue the transmission, and if it does not match, the slave should nack it. when the master is operating as a master transmitter, the data bytes will follow after the second address byte. when the master is operating as a master receiver however, a repeated start condition is sent after the second address byte. the address sent after this repeated start is equal to the first of the address bytes transmitted previously, but now with the r/w byte set, and only the slave that found a match on the entire 10-bit address in the previous message should ack this address. the repeated start should take the master into a master receiver mode, and after the single address byte sent this time around, the slave begins transmission to the master. 16.3.12 error handling 16.3.12.1 abort command some bus errors may require software intervention to be resolved. the i 2 c module provides an abort command, which can be set in i2cn_cmd, to help resolve bus errors. when the bus for some reason is locked up and the i 2 c module is in the middle of a transmission it cannot get out of, or for some other reason the i 2 c wants to abort a transmission, the abort command can be used. setting the abort command will make the i 2 c module discard any data currently being transmitted or received, release the sda and scl lines and go to an idle mode. abort effectively makes the i 2 c module forget about any ongoing transfers. 16.3.12.2 bus reset a bus reset can be performed by setting the start and stop commands in i2cn_cmd while the transmit buffer is empty. a start condition will then be transmitted, immediately followed by a stop condition. a bus reset can also be performed by transmitting a start command with the transmit buffer empty and autose set. 16.3.12.3 i 2 c-bus errors an i 2 c-bus error occurs when a start or stop condition is misplaced, which happens when the value on sda changes while scl is high during bit-transmission on the i 2 c-bus. if the i 2 c module is part of the current transmission when a bus error occurs, any data currently being transmitted or received is discarded, sda and scl are released, the buserr interrupt flag in i2cn_if is set to indicate the error, and the module automatically takes a course of action as defined in table 16.10 (p. 430 ) . table 16.10. i 2 c bus error response misplaced start misplaced stop in a master/slave operation treated as start. receive address. go idle. perform any pending actions. 16.3.12.4 bus lockup a lockup occurs when a master or slave on the i 2 c-bus has locked the sda or scl at a low value, preventing other devices from putting high values on the bus, and thus making communication on the bus impossible.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 431 www.energymicro.com many slave-only devices operating on an i 2 c-bus are not capable of driving scl low, but in the rare case that scl is stuck low, the advice is to apply a hardware reset signal to the slaves on the bus. if this does not work, cycle the power to the devices in order to make them release scl. when sda is stuck low and scl is free, a master should send 9 clock pulses on scl while tristating the sda. this procedure is performed in the gpio module after clearing the i2c_route register and disabling the i2c module. the device that held the bus low should release it sometime within those 9 clocks. if not, use the same approach as for when scl is stuck, resetting and possibly cycling power to the slaves. lockup of sda can be detected by keeping count of the number of continuous arbitration losses during address transmission. if arbitration is also lost during the transmission of a general call address, i.e. during the transmission of the stop condition, which should never happen during normal operation, this is a good indication of sda lockup. detection of scl lockups can be done using the timeout functionality defined in section 16.3.12.6 (p. 431 ) 16.3.12.5 bus idle timeout when scl has been high for a significant amount of time, this is a good indication of that the bus is idle. on an smbus system, the bus is only allowed to be in this state for a maximum of 50 s before the bus is considered idle. the bus idle timeout bito in i2cn_ctrl can be used to detect situations where the bus goes idle in the middle of a transmission. the timeout can be configured in bito, and when the bus has been idle for the given amount of time, the bito interrupt flag in i2cn_if is set. the bus can also be set idle automatically on a bus idle timeout. this is enabled by setting gibito in i2cn_ctrl. when the bus idle timer times out, it wraps around and continues counting as long as its condition is true. if the bus is not set idle using gibito or the abort command in i2cn_cmd, this will result in periodic timeouts. note this timeout will be generated even if sda is held low. the bus idle timeout is active as long as the bus is busy, i.e. busy in i2cn_status is set. the timeout can be used to get the i 2 c module out of the busy-state it enters when reset, see section 16.3.7.3 (p. 421 ) . 16.3.12.6 clock low timeout the clock timeout, which can be configured in clto in i2cn_ctrl, starts counting whenever scl goes low, and times out if scl does not go high within the configured timeout. a clock low timeout results in cltoif in i2cn_if being set, allowing software to take action. when the timer times out, it wraps around and continues counting as long as scl is low. an scl lockup will thus result in periodic clock low timeouts as long as scl is low. 16.3.13 dma support the i 2 c module has full dma support. the dma controller can write to the transmit buffer using the i2cn_txdata register, and it can read from the receive buffer using the rxdata register. a request for the dma controller to read from the i 2 c receive buffer can come from the following source: ? data available in the receive buffer a write request can come from one of the following sources:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 432 www.energymicro.com ? transmit buffer and shift register empty. no data to send ? transmit buffer empty 16.3.14 interrupts the interrupts generated by the i 2 c module are combined into one interrupt vector, i2c_int. if i 2 c interrupts are enabled, an interrupt will be made if one or more of the interrupt flags in i2cn_if and their corresponding bits in i2cn_ien are set. 16.3.15 wake-up the i 2 c receive section can be active all the way down to energy mode em3, and can wake up the cpu on address interrupt. all address match modes are supported.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 433 www.energymicro.com 16.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 i2cn_ctrl rw control register 0x004 i2cn_cmd w1 command register 0x008 i2cn_state r state register 0x00c i2cn_status r status register 0x010 i2cn_clkdiv rw clock division register 0x014 i2cn_saddr rw slave address register 0x018 i2cn_saddrmask rw slave address mask register 0x01c i2cn_rxdata r receive buffer data register 0x020 i2cn_rxdatap r receive buffer data peek register 0x024 i2cn_txdata w transmit buffer data register 0x028 i2cn_if r interrupt flag register 0x02c i2cn_ifs w1 interrupt flag set register 0x030 i2cn_ifc w1 interrupt flag clear register 0x034 i2cn_ien rw interrupt enable register 0x038 i2cn_route rw i/o routing register 16.5 register description 16.5.1 i2cn_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0x0 0x0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw name clto gibito bito clhr gcamen arbdis autosn autose autoack slave en bit name reset access description 31:19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:16 clto 0x0 rw clock low timeout use to generate a timeout when clk has been low for the given amount of time. wraps around and continues counting when the timeout is reached. value mode description 0 off timeout disabled 1 40pcc timeout after 40 prescaled clock cycles. in standard mode at 100 khz, this results in a 50us timeout. 2 80pcc timeout after 80 prescaled clock cycles. in standard mode at 100 khz, this results in a 100us timeout. 3 160pcc timeout after 160 prescaled clock cycles. in standard mode at 100 khz, this results in a 200us timeout. 4 320ppc timeout after 320 prescaled clock cycles. in standard mode at 100 khz, this results in a 400us timeout. 5 1024ppc timeout after 1024 prescaled clock cycles. in standard mode at 100 khz, this results in a 1280us timeout. 15 gibito 0 rw go idle on bus idle timeout
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 434 www.energymicro.com bit name reset access description when set, the bus automatically goes idle on a bus idle timeout, allowing new transfers to be initiated. value description 0 a bus idle timeout has no effect on the bus state. 1 a bus idle timeout tells the i 2 c module that the bus is idle, allowing new transfers to be initiated. 14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:12 bito 0x0 rw bus idle timeout use to generate a timeout when scl has been high for a given amount time between a start and stop condition. when in a bus transaction, i.e. the busy flag is set, a timer is started whenever scl goes high. when the timer reaches the value defined by bito, it sets the bito interrupt flag. the bito interrupt flag will then be set periodically as long as scl remains high. the bus idle timeout is active as long as busy is set. it is thus stopped automatically on a timeout if gibito is set. it is also stopped a stop condition is detected and when the abort command is issued. the timeout is activated whenever the bus goes busy, i.e. a start condition is detected. value mode description 0 off timeout disabled 1 40pcc timeout after 40 prescaled clock cycles. in standard mode at 100 khz, this results in a 50us timeout. 2 80pcc timeout after 80 prescaled clock cycles. in standard mode at 100 khz, this results in a 100us timeout. 3 160pcc timeout after 160 prescaled clock cycles. in standard mode at 100 khz, this results in a 200us timeout. 11:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:8 clhr 0x0 rw clock low high ratio determines the ratio between the low and high parts of the clock signal generated on scl as master. value mode description 0 standard the ratio between low period and high period counters (n low :n high ) is 4:4 1 asymmetric the ratio between low period and high period counters (n low :n high ) is 6:3 2 fast the ratio between low period and high period counters (n low :n high ) is 11:6 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 gcamen 0 rw general call address match enable set to enable address match on general call in addition to the programmed slave address. value description 0 general call address will be nack'ed if it is not included by the slave address and address mask. 1 when a general call address is received, a software response is required. 5 arbdis 0 rw arbitration disable a master or slave will not release the bus upon losing arbitration. value description 0 when a device loses arbitration, the arb interrupt flag is set and the bus is released. 1 when a device loses arbitration, the arb interrupt flag is set, but communication proceeds. 4 autosn 0 rw automatic stop on nack write to 1 to make a master transmitter send a stop when a nack is received from a slave. value description 0 stop is not automatically sent if a nack is received from a slave. 1 the master automatically sends a stop if a nack is received from a slave. 3 autose 0 rw automatic stop when empty write to 1 to make a master transmitter send a stop when no more data is available for transmission. value description 0 a stop must be sent manually when no more data is to be transmitted. 1 the master automatically sends a stop when no more data is available for transmission. 2 autoack 0 rw automatic acknowledge set to enable automatic acknowledges.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 435 www.energymicro.com bit name reset access description value description 0 software must give one ack command for each ack transmitted on the i 2 c bus. 1 addresses that are not automatically nack'ed, and all data is automatically acknowledged. 1 slave 0 rw addressable as slave set this bit to allow the device to be selected as an i 2 c slave. value description 0 all addresses will be responded to with a nack 1 addresses matching the programmed slave address or the general call address (if enabled) require a response from software. other addresses are automatically responded to with a nack. 0 en 0 rw i 2 c enable use this bit to enable or disable the i 2 c module. value description 0 the i 2 c module is disabled. and its internal state is cleared 1 the i 2 c module is enabled. 16.5.2 i2cn_cmd - command register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 name clearpc cleartx abort cont nack ack stop start bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 clearpc 0 w1 clear pending commands set to clear pending commands. 6 cleartx 0 w1 clear tx set to clear transmit buffer and shift register. will not abort ongoing transfer. 5 abort 0 w1 abort transmission abort the current transmission making the bus go idle. when used in combination with stop, a stop condition is sent as soon as possible before aborting the transmission. the stop condition is subject to clock synchronization. 4 cont 0 w1 continue transmission set to continue transmission after a nack has been received. 3 nack 0 w1 send nack set to transmit a nack the next time an acknowledge is required. 2 ack 0 w1 send ack set to transmit an ack the next time an acknowledge is required. 1 stop 0 w1 send stop condition set to send stop condition as soon as possible. 0 start 0 w1 send start condition set to send start condition as soon as possible. if a transmission is ongoing and not owned, the start condition will be sent as soon as the bus is idle. if the current transmission is owned by this module, a repeated start condition will be sent. use in combination with a stop command to automatically send a stop, then a start when the bus becomes idle.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 436 www.energymicro.com 16.5.3 i2cn_state - state register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 1 access r r r r r r name state bushold nacked transmitter master busy bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:5 state 0x0 r transmission state the state of any current transmission. cleared if the i 2 c module is idle. value mode description 0 idle no transmission is being performed. 1 wait waiting for idle. will send a start condition as soon as the bus is idle. 2 start start transmitted or received 3 addr address transmitted or received 4 addrack address ack/nack transmitted or received 5 data data transmitted or received 6 dataack data ack/nack transmitted or received 4 bushold 0 r bus held set if the bus is currently being held by this i 2 c module. 3 nacked 0 r nack received set if a nack was received and state is addrack or dataack. 2 transmitter 0 r transmitter set when operating as a master transmitter or a slave transmitter. when cleared, the system may be operating as a master receiver, a slave receiver or the current mode is not known. 1 master 0 r master set when operating as an i 2 c master. when cleared, the system may be operating as an i 2 c slave. 0 busy 1 r bus busy set when the bus is busy. whether the i 2 c module is in control of the bus or not has no effect on the value of this bit. when the mcu comes out of reset, the state of the bus is not known, and thus busy is set. use the abort command or a bus idle timeout to force the i 2 c module out of the busy state. 16.5.4 i2cn_status - status register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 1 0 0 0 0 0 0 0 access r r r r r r r r r name rxdatav txbl txc pabort pcont pnack pack pstop pstart bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 437 www.energymicro.com bit name reset access description 8 rxdatav 0 r rx data valid set when data is available in the receive buffer. cleared when the receive buffer is empty. 7 txbl 1 r tx buffer level indicates the level of the transmit buffer. set when the transmit buffer is empty, and cleared when it is full. 6 txc 0 r tx complete set when a transmission has completed and no more data is available in the transmit buffer. cleared when a new transmission starts. 5 pabort 0 r pending abort an abort is pending and will be transmitted as soon as possible. 4 pcont 0 r pending continue a continue is pending and will be transmitted as soon as possible. 3 pnack 0 r pending nack a not-acknowledge is pending and will be transmitted as soon as possible. 2 pack 0 r pending ack an acknowledge is pending and will be transmitted as soon as possible. 1 pstop 0 r pending stop a stop condition is pending and will be transmitted as soon as possible. 0 pstart 0 r pending start a start condition is pending and will be transmitted as soon as possible. 16.5.5 i2cn_clkdiv - clock division register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 access rw name div bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 div 0x000 rw clock divider specifies the clock divider for the i 2 c. note that div must be 1 or higher when slave is enabled. 16.5.6 i2cn_saddr - slave address register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name addr
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 438 www.energymicro.com bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:1 addr 0x00 rw slave address specifies the slave address of the device. 0 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16.5.7 i2cn_saddrmask - slave address mask register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name mask bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:1 mask 0x00 rw slave address mask specifies the significant bits of the slave address. setting the mask to 0x00 will match all addresses, while setting it to 0x7f will only match the exact address specified by addr. 0 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16.5.8 i2cn_rxdata - receive buffer data register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access r name rxdata bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 rxdata 0x00 r rx data use this register to read from the receive buffer. buffer is emptied on read access.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 439 www.energymicro.com 16.5.9 i2cn_rxdatap - receive buffer data peek register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access r name rxdatap bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 rxdatap 0x00 r rx data peek use this register to read from the receive buffer. buffer is not emptied on read access. 16.5.10 i2cn_txdata - transmit buffer data register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access w name txdata bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 txdata 0x00 w tx data use this register to write a byte to the transmit buffer. 16.5.11 i2cn_if - interrupt flag register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 access r r r r r r r r r r r r r r r r r name sstop clto bito rxuf txof bushold buserr arblost mstop nack ack rxdatav txbl txc addr rstart start bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 sstop 0 r slave stop condition interrupt flag set when a stop condition has been received. will be set regardless of the efm32 being involved in the transaction or not. 15 clto 0 r clock low timeout interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 440 www.energymicro.com bit name reset access description set on each clock low timeout. the timeout value can be set in clto bit field in the i2cn_ctrl register. 14 bito 0 r bus idle timeout interrupt flag set on each bus idle timeout. the timeout value can be set in the bito bit field in the i2cn_ctrl register. 13 rxuf 0 r receive buffer underflow interrupt flag set when data is read from the receive buffer through the i2cn_rxdata register while the receive buffer is empty. 12 txof 0 r transmit buffer overflow interrupt flag set when data is written to the transmit buffer while the transmit buffer is full. 11 bushold 0 r bus held interrupt flag set when the bus becomes held by the i 2 c module. 10 buserr 0 r bus error interrupt flag set when a bus error is detected. the bus error is resolved automatically, but the current transfer is aborted. 9 arblost 0 r arbitration lost interrupt flag set when arbitration is lost. 8 mstop 0 r master stop condition interrupt flag set when a stop condition has been successfully transmitted. if arbitration is lost during the transmission of the stop condition, then the mstop interrupt flag is not set. 7 nack 0 r not acknowledge received interrupt flag set when a nack has been received. 6 ack 0 r acknowledge received interrupt flag set when an ack has been received. 5 rxdatav 0 r receive data valid interrupt flag set when data is available in the receive buffer. cleared automatically when the receive buffer is read. 4 txbl 1 r transmit buffer level interrupt flag set when the transmit buffer becomes empty. cleared automatically when new data is written to the transmit buffer. 3 txc 0 r transfer completed interrupt flag set when the transmit shift register becomes empty and there is no more data in the transmit buffer. 2 addr 0 r address interrupt flag set when incoming address is accepted, i.e. own address or general call address is received. 1 rstart 0 r repeated start condition interrupt flag set when a repeated start condition is detected. 0 start 0 r start condition interrupt flag set when a start condition is successfully transmitted. 16.5.12 i2cn_ifs - interrupt flag set register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name sstop clto bito rxuf txof bushold buserr arblost mstop nack ack txc addr rstart start bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 441 www.energymicro.com bit name reset access description 16 sstop 0 w1 set sstop interrupt flag write to 1 to set the sstop interrupt flag. 15 clto 0 w1 set clock low interrupt flag write to 1 to set the clto interrupt flag. 14 bito 0 w1 set bus idle timeout interrupt flag write to 1 to set the bito interrupt flag. 13 rxuf 0 w1 set receive buffer underflow interrupt flag write to 1 to set the rxuf interrupt flag. 12 txof 0 w1 set transmit buffer overflow interrupt flag write to 1 to set the txof interrupt flag. 11 bushold 0 w1 set bus held interrupt flag write to 1 to set the bushold interrupt flag. 10 buserr 0 w1 set bus error interrupt flag write to 1 to set the buserr interrupt flag. 9 arblost 0 w1 set arbitration lost interrupt flag write to 1 to set the arblost interrupt flag. 8 mstop 0 w1 set mstop interrupt flag write to 1 to set the mstop interrupt flag. 7 nack 0 w1 set not acknowledge received interrupt flag write to 1 to set the nack interrupt flag. 6 ack 0 w1 set acknowledge received interrupt flag write to 1 to set the ack interrupt flag. 5:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 txc 0 w1 set transfer completed interrupt flag write to 1 to set the txc interrupt flag. 2 addr 0 w1 set address interrupt flag write to 1 to set the addr interrupt flag. 1 rstart 0 w1 set repeated start interrupt flag write to 1 to set the rstart interrupt flag. 0 start 0 w1 set start interrupt flag write to 1 to set the start interrupt flag. 16.5.13 i2cn_ifc - interrupt flag clear register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name sstop clto bito rxuf txof bushold buserr arblost mstop nack ack txc addr rstart start bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 sstop 0 w1 clear sstop interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 442 www.energymicro.com bit name reset access description write to 1 to clear the sstop interrupt flag. 15 clto 0 w1 clear clock low interrupt flag write to 1 to clear the clto interrupt flag. 14 bito 0 w1 clear bus idle timeout interrupt flag write to 1 to clear the bito interrupt flag. 13 rxuf 0 w1 clear receive buffer underflow interrupt flag write to 1 to clear the rxuf interrupt flag. 12 txof 0 w1 clear transmit buffer overflow interrupt flag write to 1 to clear the txof interrupt flag. 11 bushold 0 w1 clear bus held interrupt flag write to 1 to clear the bushold interrupt flag. 10 buserr 0 w1 clear bus error interrupt flag write to 1 to clear the buserr interrupt flag. 9 arblost 0 w1 clear arbitration lost interrupt flag write to 1 to clear the arblost interrupt flag. 8 mstop 0 w1 clear mstop interrupt flag write to 1 to clear the mstop interrupt flag. 7 nack 0 w1 clear not acknowledge received interrupt flag write to 1 to clear the nack interrupt flag. 6 ack 0 w1 clear acknowledge received interrupt flag write to 1 to clear the ack interrupt flag. 5:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 txc 0 w1 clear transfer completed interrupt flag write to 1 to clear the txc interrupt flag. 2 addr 0 w1 clear address interrupt flag write to 1 to clear the addr interrupt flag. 1 rstart 0 w1 clear repeated start interrupt flag write to 1 to clear the rstart interrupt flag. 0 start 0 w1 clear start interrupt flag write to 1 to clear the start interrupt flag. 16.5.14 i2cn_ien - interrupt enable register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name sstop clto bito rxuf txof bushold buserr arblost mstop nack ack rxdatav txbl txc addr rstart start bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 sstop 0 rw sstop interrupt enable enable interrupt on sstop.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 443 www.energymicro.com bit name reset access description 15 clto 0 rw clock low interrupt enable enable interrupt on clock low timeout. 14 bito 0 rw bus idle timeout interrupt enable enable interrupt on bus idle timeout. 13 rxuf 0 rw receive buffer underflow interrupt enable enable interrupt on receive buffer underflow. 12 txof 0 rw transmit buffer overflow interrupt enable enable interrupt on transmit buffer overflow. 11 bushold 0 rw bus held interrupt enable enable interrupt on bus-held. 10 buserr 0 rw bus error interrupt enable enable interrupt on bus error. 9 arblost 0 rw arbitration lost interrupt enable enable interrupt on loss of arbitration. 8 mstop 0 rw mstop interrupt enable enable interrupt on mstop. 7 nack 0 rw not acknowledge received interrupt enable enable interrupt when not-acknowledge is received. 6 ack 0 rw acknowledge received interrupt enable enable interrupt on acknowledge received. 5 rxdatav 0 rw receive data valid interrupt enable enable interrupt on receive buffer full. 4 txbl 0 rw transmit buffer level interrupt enable enable interrupt on transmit buffer level. 3 txc 0 rw transfer completed interrupt enable enable interrupt on transfer completed. 2 addr 0 rw address interrupt enable enable interrupt on recognized address. 1 rstart 0 rw repeated start condition interrupt enable enable interrupt on transmitted or received repeated start condition. 0 start 0 rw start condition interrupt enable enable interrupt on transmitted or received start condition. 16.5.15 i2cn_route - i/o routing register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 access rw rw rw name location sclpen sdapen bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 444 www.energymicro.com bit name reset access description 10:8 location 0x0 rw i/o location decides the location of the i 2 c i/o pins. value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 3 loc3 location 3 4 loc4 location 4 5 loc5 location 5 6 loc6 location 6 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 sclpen 0 rw scl pin enable when set, the scl pin of the i 2 c is enabled. 0 sdapen 0 rw sda pin enable when set, the sda pin of the i 2 c is enabled.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 445 www.energymicro.com 17 usart - universal synchronous asynchronous receiver/transmitter 0 1 2 3 4 usart rx / m i s o tx/ m o s i dma cont roller ram clk cs efm32 spi usart sm art cards irda quick facts what? the usart handles high-speed uart, spi- bus, smartcards, and irda communication. why? serial communication is frequently used in embedded systems and the usart allows efficient communication with a wide range of external devices. how? the usart has a wide selection of operating modes, frame formats and baud rates. the multi-processor mode allows the usart to remain idle when not addressed. triple buffering and dma support makes high data- rates possible with minimal cpu intervention and it is possible to transmit and receive large frames while the mcu remains in em1. 17.1 introduction the universal synchronous asynchronous serial receiver and transmitter (usart) is a very flexible serial i/o module. it supports full duplex asynchronous uart communication as well as rs-485, spi, microwire and 3-wire. it can also interface with iso7816 smartcards, and irda devices. 17.2 features ? asynchronous and synchronous (spi) communication ? full duplex and half duplex ? separate tx/rx enable ? separate receive / transmit 2-level buffers, with additional separate shift registers ? programmable baud rate, generated as an fractional division from the peripheral clock (hfperclk usartn ) ? max bit-rate ? spi master mode, peripheral clock rate/2 ? spi slave mode, peripheral clock rate/8 ? uart mode, peripheral clock rate/16, 8, 6, or 4 ? asynchronous mode supports ? majority vote baud-reception ? false start-bit detection ? break generation/detection ? multi-processor mode ? synchronous mode supports ? all 4 spi clock polarity/phase configurations ? master and slave mode ? data can be transmitted lsb first or msb first
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 446 www.energymicro.com ? configurable number of data bits, 4-16 (plus the parity bit, if enabled) ? hw parity bit generation and check ? configurable number of stop bits in asynchronous mode: 0.5, 1, 1.5, 2 ? hw collision detection ? multi-processor mode ? irda modulator on usart0 ? smartcard (iso7816) mode ? i2s mode ? separate interrupt vectors for receive and transmit interrupts ? loopback mode ? half duplex communication ? communication debugging ? prs rx input 17.3 functional description an overview of the usart module is shown in figure 17.1 (p. 446 ) . figure 17.1. usart overview tx buffer ( 2-level fifo) tx shift regist er u(s)n_tx rx buffer ( 2-level fifo) rx shift regist er uart cont rol and st at us peripheral bus baud rat e generat or usn_clk pin ct rl usn_cs u(s)n_rx irda m odulat or irda dem odulat or ! rxblock prs input s 17.3.1 modes of operation the usart operates in either asynchronous or synchronous mode. in synchronous mode, a separate clock signal is transmitted with the data. this clock signal is generated by the bus master, and both the master and slave sample and transmit data according to this clock. both master and slave modes are supported by the usart. the synchronous communication mode is compatible with the serial peripheral interface bus (spi) standard. in asynchronous mode, no separate clock signal is transmitted with the data on the bus. the usart receiver thus has to determine where to sample the data on the bus from the actual data. to make this
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 447 www.energymicro.com possible, additional synchronization bits are added to the data when operating in asynchronous mode, resulting in a slight overhead. asynchronous or synchronous mode can be selected by configuring sync in usartn_ctrl. the options are listed with supported protocols in table 17.1 (p. 447 ) . full duplex and half duplex communication is supported in both asynchronous and synchronous mode. table 17.1. usart asynchronous vs. synchronous mode sync communication mode supported protocols 0 asynchronous rs-232, rs-485 (w/external driver), irda, iso 7816 1 synchronous spi, microwire, 3-wire table 17.2 (p. 447 ) explains the functionality of the different usart pins when the usart operates in different modes. pin functionality enclosed in square brackets is optional, and depends on additional configuration parameters. loopbk and master are discussed in section 17.3.2.5 (p. 455 ) and section 17.3.3.3 (p. 462 ) respectively. table 17.2. usart pin usage pin functionality sync loopbk master u(s)n_tx (mosi) u(s)n_rx (miso) usn_clk usn_cs 0 0 x data out data in - [driver enable] 1 1 x data out/in - - [driver enable] 1 0 0 data in data out clock in slave select 1 0 1 data out data in clock out [auto slave select] 1 1 0 data out/in - clock in slave select 1 1 1 data out/in - clock out [auto slave select] 17.3.2 asynchronous operation 17.3.2.1 frame format the frame format used in asynchronous mode consists of a set of data bits in addition to bits for synchronization and optionally a parity bit for error checking. a frame starts with one start-bit (s), where the line is driven low for one bit-period. this signals the start of a frame, and is used for synchronization. following the start bit are 4 to 16 data bits and an optional parity bit. finally, a number of stop-bits, where the line is driven high, end the frame. an example frame is shown in figure 17.2 (p. 447 ) . figure 17.2. usart asynchronous frame format s 0 1 2 3 4 [ 5] [ 6] [ 7] [ 8] [ p] st op st art or idle st op or idle fram e the number of data bits in a frame is set by databits in usartn_frame, see table 17.3 (p. 448 ) , and the number of stop-bits is set by stopbits in usartn_frame, see table 17.4 (p. 448 ) . whether or not a parity bit should be included, and whether it should be even or odd is defined by parity, also in usartn_frame. for communication to be possible, all parties of an asynchronous transfer must agree on the frame format being used.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 448 www.energymicro.com table 17.3. usart data bits data bits [3:0] number of data bits 0001 4 0010 5 0011 6 0100 7 0101 8 (default) 0110 9 0111 10 1000 11 1001 12 1010 13 1011 14 1100 15 1101 16 table 17.4. usart stop bits stop bits [1:0] number of stop bits 00 0.5 01 1 (default) 10 1.5 11 2 the order in which the data bits are transmitted and received is defined by msbf in usartn_ctrl. when msbf is cleared, data in a frame is sent and received with the least significant bit first. when it is set, the most significant bit comes first. the frame format used by the transmitter can be inverted by setting txinv in usartn_ctrl, and the format expected by the receiver can be inverted by setting rxinv in usartn_ctrl. these bits affect the entire frame, not only the data bits. an inverted frame has a low idle state, a high start-bit, inverted data and parity bits, and low stop-bits. 17.3.2.1.1 parity bit calculation and handling when parity bits are enabled, hardware automatically calculates and inserts any parity bits into outgoing frames, and verifies the received parity bits in incoming frames. this is true for both asynchronous and synchronous modes, even though it is mostly used in asynchronous communication. the possible parity modes are defined in table 17.5 (p. 449 ) . when even parity is chosen, a parity bit is inserted to make the number of high bits (data + parity) even. if odd parity is chosen, the parity bit makes the total number of high bits odd.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 449 www.energymicro.com table 17.5. usart parity bits stop bits [1:0] description 00 no parity bit (default) 01 reserved 10 even parity 11 odd parity 17.3.2.2 clock generation the usart clock defines the transmission and reception data rate. when operating in asynchronous mode, the baud rate (bit-rate) is given by equation 17.1 (p. 449 ) usart baud rate br = f hfperclk /(oversample x (1 + usartn_clkdiv/256)) (17.1) where f hfperclk is the peripheral clock (hfperclk usartn ) frequency and oversample is the oversampling rate as defined by ovs in usartn_ctrl, see table 17.6 (p. 449 ) . table 17.6. usart oversampling ovs [1:0] oversample 00 16 01 8 10 6 11 4 the usart has a fractional clock divider to allow the usart clock to be controlled more accurately than what is possible with a standard integral divider. the clock divider used in the usart is a 15-bit value, with a 13-bit integral part and a 2-bit fractional part. the fractional part is configured in the two lsbs of div in usart_clkdiv. the lowest achievable baud rate at 32 mhz is about 244 bauds/sec. fractional clock division is implemented by distributing the selected fraction over four baud periods. the fractional part of the divider tells how many of these periods should be extended by one peripheral clock cycle. given a desired baud rate br desired , the clock divider usartn_clkdiv can be calculated by using equation 17.2 (p. 449 ) : usart desired baud rate usartn_clkdiv = 256 x (f hfperclk /(oversample x br desired ) - 1) (17.2) table 17.7 (p. 450 ) shows a set of desired baud rates and how accurately the usart is able to generate these baud rates when running at a 4 mhz peripheral clock, using 16x or 8x oversampling.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 450 www.energymicro.com table 17.7. usart baud rates @ 4mhz peripheral clock usartn_ovs =00 usartn_ovs =01 desired baud rate [baud/s] usartn_clkdiv/256 actual baud rate [baud/s] error % usartn_clkdiv/256 actual baud rate [baud/s] error % 600 415,75 599,88 -0,02 832,25 600,06 0,01 1200 207,25 1200,48 0,04 415,75 1199,76 -0,02 2400 103,25 2398,082 -0,08 207,25 2400,96 0,04 4800 51 4807,692 0,16 103,25 4796,163 -0,08 9600 25 9615,385 0,16 51 9615,385 0,16 14400 16,25 14492,75 0,64 33,75 14388,49 -0,08 19200 12 19230,77 0,16 25 19230,77 0,16 28800 7,75 28571,43 -0,79 16,25 28985,51 0,64 38400 5,5 38461,54 0,16 12 38461,54 0,16 57600 3,25 58823,53 2,12 7,75 57142,86 -0,79 76800 2,25 76923,08 0,16 5,5 76923,08 0,16 115200 1,25 111111,1 -3,55 3,25 117647,1 2,12 230400 0 250000 8,51 1,25 222222,2 -3,55 17.3.2.3 data transmission asynchronous data transmission is initiated by writing data to the transmit buffer using one of the methods described in section 17.3.2.3.1 (p. 450 ) . when the transmission shift register is empty and ready for new data, a frame from the transmit buffer is loaded into the shift register, and if the transmitter is enabled, transmission begins. when the frame has been transmitted, a new frame is loaded into the shift register if available, and transmission continues. if the transmit buffer is empty, the transmitter goes to an idle state, waiting for a new frame to become available. transmission is enabled through the command register usartn_cmd by setting txen, and disabled by setting txdis in the same command register. when the transmitter is disabled using txdis, any ongoing transmission is aborted, and any frame currently being transmitted is discarded. when disabled, the tx output goes to an idle state, which by default is a high value. whether or not the transmitter is enabled at a given time can be read from txens in usartn_status. when the usart transmitter is enabled and there is no data in the transmit shift register or transmit buffer, the txc flag in usartn_status and the txc interrupt flag in usartn_if are set, signaling that the transmitter is idle. the txc status flag is cleared when a new frame becomes available for transmission, but the txc interrupt flag must be cleared by software. 17.3.2.3.1 transmit buffer operation the transmit-buffer is a 2-level fifo buffer. a frame can be loaded into the buffer by writing to usartn_txdata, usartn_txdatax, usartn_txdouble or usartn_txdoublex. using usartn_txdata allows 8 bits to be written to the buffer, while using usartn_txdouble will write 2 frames of 8 bits to the buffer. if 9-bit frames are used, the 9th bit of the frames will in these cases be set to the value of bit8dv in usartn_ctrl. to set the 9th bit directly and/or use transmission control, usartn_txdatax and usartn_txdoublex must be used. usartn_txdatax allows 9 data bits to be written, as well as a set of control bits regarding the transmission of the written frame. every frame in the buffer is stored with 9 data bits and additional transmission control bits. usartn_txdoublex allows two
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 451 www.energymicro.com frames, complete with control bits to be written at once. when data is written to the transmit buffer using usartn_txdatax and usartn_txdoublex, the 9th bit(s) written to these registers override the value in bit8dv in usartn_ctrl, and alone define the 9th bits that are transmitted if 9-bit frames are used. figure 17.3 (p. 451 ) shows the basics of the transmit buffer when databits in usartn_frame is configured to less than 10 bits. figure 17.3. usart transmit buffer operation writ e ctrl writ e ctrl tx buffer elem ent 1 tx buffer elem ent 0 shift regist er peripheral bus writ e ctrl txdouble, txdoublex txdata, txdatax when writing more frames to the transmit buffer than there is free space for, the txof interrupt flag in usartn_if will be set, indicating the overflow. the data already in the transmit buffer is preserved in this case, and no data is written. in addition to the interrupt flag txc in usartn_if and status flag txc in usartn_status which are set when the transmitter is idle, txbl in usartn_status and the txbl interrupt flag in usartn_if are used to indicate the level of the transmit buffer. txbil in usartn_ctrl controls the level at which these bits are set. if txbil is cleared, they are set whenever the transmit buffer becomes empty, and if txbil is set, they are set whenever the transmit buffer goes from full to half-full or empty. both the txbl status flag and the txbl interrupt flag are cleared automatically when their condition becomes false the transmit buffer, including the transmit shift register can be cleared by setting cleartx in usartn_cmd. this will prevent the usart from transmitting the data in the buffer and shift register, and will make them available for new data. any frame currently being transmitted will not be aborted. transmission of this frame will be completed. 17.3.2.3.2 frame transmission control the transmission control bits, which can be written using usartn_txdatax and usartn_txdoublex, affect the transmission of the written frame. the following options are available: ? generate break: by setting txbreak, the output will be held low during the stop-bit period to generate a framing error. a receiver that supports break detection detects this state, allowing it to be used e.g. for framing of larger data packets. the line is driven high before the next frame is transmitted so the next start condition can be identified correctly by the recipient. continuous breaks lasting longer than a usart frame are thus not supported by the usart. gpio can be used for this. ? disable transmitter after transmission: if txdisat is set, the transmitter is disabled after the frame has been fully transmitted. ? enable receiver after transmission: if rxenat is set, the receiver is enabled after the frame has been fully transmitted. it is enabled in time to detect a start-bit directly after the last stop-bit has been transmitted. ? unblock receiver after transmission: if ubrxat is set, the receiver is unblocked and rxblock is cleared after the frame has been fully transmitted. ? tristate transmitter after transmission: if txtriat is set, txtri is set after the frame has been fully transmitted, tristating the transmitter output. tristating of the output can also be performed automatically by setting autotri. if autotri is set txtri is always read as 0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 452 www.energymicro.com note when in smartcard mode with repeat enabled, none of the actions, except generate break, will be performed until the frame is transmitted without failure. generation of a break in smartcard mode with repeat enabled will cause the usart to detect a nack on every frame. 17.3.2.4 data reception data reception is enabled by setting rxen in usartn_cmd. when the receiver is enabled, it actively samples the input looking for a transition from high to low indicating the start baud of a new frame. when a start baud is found, reception of the new frame begins if the receive shift register is empty and ready for new data. when the frame has been received, it is pushed into the receive buffer, making the shift register ready for another frame of data, and the receiver starts looking for another start baud. if the receive buffer is full, the received frame remains in the shift register until more space in the receive buffer is available. if an incoming frame is detected while both the receive buffer and the receive shift register are full, the data in the shift register is overwritten, and the rxof interrupt flag in usartn_if is set to indicate the buffer overflow. the receiver can be disabled by setting the command bit rxdis in usartn_cmd. any frame currently being received when the receiver is disabled is discarded. whether or not the receiver is enabled at a given time can be read out from rxens in usartn_status. 17.3.2.4.1 receive buffer operation when data becomes available in the receive buffer, the rxdatav flag in usartn_status, and the rxdatav interrupt flag in usartn_if are set, and when the buffer becomes full, rxfull in usartn_status and the rxfull interrupt flag in usartn_if are set. the status flags rxdatav and rxfull are automatically cleared by hardware when their condition is no longer true. this also goes for the rxdatav interrupt flag, but the rxfull interrupt flag must be cleared by software. when the rxfull flag is set, notifying that the buffer is full, space is still available in the receive shift register for one more frame. data can be read from the receive buffer in a number of ways. usartn_rxdata gives access to the 8 least significant bits of the received frame, and usartn_rxdouble makes it possible to read the 8 least significant bits of two frames at once, pulling two frames from the buffer. to get access to the 9th, most significant bit, usartn_rxdatax must be used. this register also contains status information regarding the frame. usartn_rxdoublex can be used to get two frames complete with the 9th bits and status bits. when a frame is read from the receive buffer using usartn_rxdata or usartn_rxdatax, the frame is pulled out of the buffer, making room for a new frame. usartn_rxdouble and usartn_rxdoublex pull two frames out of the buffer. if an attempt is done to read more frames from the buffer than what is available, the rxuf interrupt flag in usartn_if is set to signal the underflow, and the data read from the buffer is undefined. frames can be read from the receive buffer without removing the data by using usartn_rxdataxp and usartn_rxdoublexp. usartn_rxdataxp gives access the first frame in the buffer with status bits, while usartn_rxdoublexp gives access to both frames with status bits. the data read from these registers when the receive buffer is empty is undefined. if the receive buffer contains one valid frame, the first frame in usartn_rxdoublexp will be valid. no underflow interrupt is generated by a read using these registers, i.e. rxuf in usartn_if is never set as a result of reading from usartn_rxdataxp or usartn_rxdoublexp. the basic operation of the receive buffer when databits in usartn_frame is configured to less than 10 bits is shown in figure 17.4 (p. 453 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 453 www.energymicro.com figure 17.4. usart receive buffer operation st at us rx buffer elem ent 0 rx buffer elem ent 1 shift regist er peripheral bus st at us st at us rxdouble rxdoublex rxdoublexp rxdata, rxdatax , rxdataxp the receive buffer, including the receive shift register can be cleared by setting clearrx in usartn_cmd. any frame currently being received will not be discarded. 17.3.2.4.2 blocking incoming data when using hardware frame recognition, as detailed in section 17.3.2.8 (p. 458 ) and section 17.3.2.9 (p. 459 ) , it is necessary to be able to let the receiver sample incoming frames without passing the frames to software by loading them into the receive buffer. this is accomplished by blocking incoming data. incoming data is blocked as long as rxblock in usartn_status is set. when blocked, frames received by the receiver will not be loaded into the receive buffer, and software is not notified by the rxdatav flag in usartn_status or the rxdatav interrupt flag in usartn_if at their arrival. for data to be loaded into the receive buffer, rxblock must be cleared in the instant a frame is fully received by the receiver. rxblock is set by setting rxblocken in usartn_cmd and disabled by setting rxblockdis also in usartn_cmd. there is one exception where data is loaded into the receive buffer even when rxblock is set. this is when an address frame is received when operating in multi-processor mode. see section 17.3.2.8 (p. 458 ) for more information. frames received containing framing or parity errors will not result in the ferr and perr interrupt flags in usartn_if being set while rxblock in usartn_status is set. hardware recognition is not applied to these erroneous frames, and they are silently discarded. note if a frame is received while rxblock in usartn_status is cleared, but stays in the receive shift register because the receive buffer is full, the received frame will be loaded into the receive buffer when space becomes available even if rxblock is set at that time. the overflow interrupt flag rxof in usartn_if will be set if a frame in the receive shift register, waiting to be loaded into the receive buffer is overwritten by an incoming frame even though rxblock in usartn_status is set. 17.3.2.4.3 clock recovery and filtering the receiver samples the incoming signal at a rate 16, 8, 6 or 4 times higher than the given baud rate, depending on the oversampling mode given by ovs in usartn_ctrl. lower oversampling rates make higher baud rates possible, but give less room for errors. when a high-to-low transition is registered on the input while the receiver is idle, this is recognized as a start-bit, and the baud rate generator is synchronized with the incoming frame. for oversampling modes 16, 8 and 6, every bit in the incoming frame is sampled three times to gain a level of noise immunity. these samples are aimed at the middle of the bit-periods, as visualized in figure 17.5 (p. 454 ) . with ovs=0 in usartn_ctrl, the start and data bits are thus sampled at
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 454 www.energymicro.com locations 8, 9 and 10 in the figure, locations 4, 5 and 6 for ovs=1 and locations 3, 4, and 5 for ovs=2. the value of a sampled bit is determined by majority vote. if two or more of the three bit-samples are high, the resulting bit value is high. if the majority is low, the resulting bit value is low. majority vote is used for all oversampling modes except 4x oversampling. in this mode, a single sample is taken at position 3 as shown in figure 17.5 (p. 454 ) . majority vote can be disabled by setting mvdis in usartn_ctrl. if the value of the start bit is found to be high, the reception of the frame is aborted, filtering out false start bits possibly generated by noise on the input. figure 17.5. usart sampling of start and data bits 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 idle st art bit bit 0 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 13 7 12 ovs = 0 ovs = 1 0 1 2 3 4 5 6 1 ovs = 2 1 2 3 4 1 2 3 4 ovs = 3 2 3 4 5 0 if the baud rate of the transmitter and receiver differ, the location each bit is sampled will be shifted towards the previous or next bit in the frame. this is acceptable for small errors in the baud rate, but for larger errors, it will result in transmission errors. when the number of stop bits is 1 or more, stop bits are sampled like the start and data bits as seen in figure 17.6 (p. 454 ) . when a stop bit has been detected by sampling at positions 8, 9 and 10 for normal mode, or 4, 5 and 6 for smart mode, the usart is ready for a new start bit. as seen in figure 17.6 (p. 454 ) , a stop-bit of length 1 normally ends at c, but the next frame will be received correctly as long as the start-bit comes after position a for ovs=0 and ovs=3, and b for ovs=1 and ovs=2. figure 17.6. usart sampling of stop bits when number of stop bits are 1 or more 5 13 14 15 16 1 2 3 4 5 6 7 8 9 10 0/1 1 st op bit 7 8 1 2 3 4 5 6 x 0/1 x ovs = 0 ovs = 1 x x x x n?t h bit a b c idle or st art bit 0/1 ovs = 2 4 1 2 3 0/1 ovs = 3 2 3 4 6 1 1 1
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 455 www.energymicro.com when working with stop bit lengths of half a baud period, the above sampling scheme no longer suffices. in this case, the stop-bit is not sampled, and no framing error is generated in the receiver if the stop- bit is not generated. the line must still be driven high before the next start bit however for the usart to successfully identify the start bit. 17.3.2.4.4 parity error when parity bits are enabled, a parity check is automatically performed on incoming frames. when a parity error is detected in an incoming frame, the data parity error bit perr in the frame is set, as well as the interrupt flag perr in usartn_if. frames with parity errors are loaded into the receive buffer like regular frames. perr can be accessed by reading the frame from the receive buffer using the usartn_rxdatax, usartn_rxdataxp, usartn_rxdoublex or usartn_rxdoublexp registers. if errstx in usartn_ctrl is set, the transmitter is disabled on received parity and framing errors. if errsrx in usartn_ctrl is set, the receiver is disabled on parity and framing errors. 17.3.2.4.5 framing error and break detection a framing error is the result of an asynchronous frame where the stop bit was sampled to a value of 0. this can be the result of noise and baud rate errors, but can also be the result of a break generated by the transmitter on purpose. when a framing error is detected in an incoming frame, the framing error bit ferr in the frame is set. the interrupt flag ferr in usartn_if is also set. frames with framing errors are loaded into the receive buffer like regular frames. ferr can be accessed by reading the frame from the receive buffer using the usartn_rxdatax, usartn_rxdataxp, usartn_rxdoublex or usartn_rxdoublexp registers. if errstx in usartn_ctrl is set, the transmitter is disabled on parity and framing errors. if errsrx in usartn_ctrl is set, the receiver is disabled on parity and framing errors. 17.3.2.5 local loopback the usart receiver samples u(s)n_rx by default, and the transmitter drives u(s)n_tx by default. this is not the only option however. when loopbk in usartn_ctrl is set, the receiver is connected to the u(s)n_tx pin as shown in figure 17.7 (p. 455 ) . this is useful for debugging, as the usart can receive the data it transmits, but it is also used to allow the usart to read and write to the same pin, which is required for some half duplex communication modes. in this mode, the u(s)n_tx pin must be enabled as an output in the gpio. figure 17.7. usart local loopback usart rx u(s)n_rx tx u(s)n_tx loobpk = 0 c usart rx u(s)n_rx tx u(s)n_tx loobpk = 1 c 17.3.2.6 asynchronous half duplex communication when doing full duplex communication, two data links are provided, making it possible for data to be sent and received at the same time. in half duplex mode, data is only sent in one direction at a time. there are several possible half duplex setups, as described in the following sections.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 456 www.energymicro.com 17.3.2.6.1 single data-link in this setup, the usart both receives and transmits data on the same pin. this is enabled by setting loopbk in usartn_ctrl, which connects the receiver to the transmitter output. because they are both connected to the same line, it is important that the usart transmitter does not drive the line when receiving data, as this would corrupt the data on the line. when communicating over a single data-link, the transmitter must thus be tristated whenever not transmitting data. this is done by setting the command bit txtrien in usartn_cmd, which tristates the transmitter. before transmitting data, the command bit txtridis, also in usartn_cmd, must be set to enable transmitter output again. whether or not the output is tristated at a given time can be read from txtri in usartn_status. if txtri is set when transmitting data, the data is shifted out of the shift register, but is not put out on u(s)n_tx. when operating a half duplex data bus, it is common to have a bus master, which first transmits a request to one of the bus slaves, then receives a reply. in this case, the frame transmission control bits, which can be set by writing to usartn_txdatax, can be used to make the usart automatically disable transmission, tristate the transmitter and enable reception when the request has been transmitted, making it ready to receive a response from the slave. tristating the transmitter can also be performed automatically by the usart by using autotri in usartn_ctrl. when autotri is set, the usart automatically tristates u(s)n_tx whenever the transmitter is idle, and enables transmitter output when the transmitter goes active. if autotri is set txtri is always read as 0. note another way to tristate the transmitter is to enable wired-and or wired-or mode in gpio. for wired-and mode, outputting a 1 will be the same as tristating the output, and for wired- or mode, outputting a 0 will be the same as tristating the output. this can only be done on buses with a pull-up or pull-down resistor respectively. 17.3.2.6.2 single data-link with external driver some communication schemes, such as rs-485 rely on an external driver. here, the driver has an extra input which enables it, and instead of tristating the transmitter when receiving data, the external driver must be disabled. this can be done manually by assigning a gpio to turn the driver on or off, or it can be handled automatically by the usart. if autocs in usartn_ctrl is set, the usn_cs output is automatically activated one baud period before the transmitter starts transmitting data, and deactivated when the last bit has been transmitted and there is no more data in the transmit buffer to transmit, or the transmitter becomes disabled. this feature can be used to turn the external driver on when transmitting data, and turn it off when the data has been transmitted. figure 17.8 (p. 456 ) shows an example configuration where usn_cs is used to automatically enable and disable an external driver. figure 17.8. usart half duplex communication with external driver usart rx tx c cs
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 457 www.energymicro.com the usn_cs output is active low by default, but its polarity can be changed with csinv in usartn_ctrl. autocs works regardless of which mode the usart is in, so this functionality can also be used for automatic chip/slave select when in synchronous mode (e.g. spi). 17.3.2.6.3 two data-links some limited devices only support half duplex communication even though two data links are available. in this case software is responsible for making sure data is not transmitted when incoming data is expected. 17.3.2.7 large frames as each frame in the transmit and receive buffers holds a maximum of 9 bits, both the elements in the buffers are combined when working with usart-frames of 10 or more data bits. to transmit such a frame, at least two elements must be available in the transmit buffer. if only one element is available, the usart will wait for the second element before transmitting the combined frame. both the elements making up the frame are consumed when transmitting such a frame. when using large frames, the 9th bits in the buffers are unused. for an 11 bit frame, the 8 least significant bits are thus taken from the first element in the buffer, and the 3 remaining bits are taken from the second element as shown in figure 17.9 (p. 457 ) . the first element in the transmit buffer, i.e. element 0 in figure 17.9 (p. 457 ) is the first element written to the fifo, or the least significant byte when writing two bytes at a time using usartn_txdouble. figure 17.9. usart transmission of large frames writ e ctrl writ e ctrl writ e ctrl tx buffer elem ent 1 tx buffer elem ent 0 shift regist er peripheral bus 0 1 2 3 4 5 6 7 0 1 2 0 1 2 0 1 2 3 4 5 6 7 as shown in figure 17.9 (p. 457 ) , frame transmission control bits are taken from the second element in fifo. the two buffer elements can be written at the same time using the usartn_txdouble or usartn_txdoublex register. the txdatax0 bitfield then refers to buffer element 0, and txdatax1 refers to buffer element 1.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 458 www.energymicro.com figure 17.10. usart transmission of large frames, msbf tx buffer elem ent 1 tx buffer elem ent 0 shift regist er peripheral bus 2 1 0 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 0 1 2 figure 17.10 (p. 458 ) illustrates the order of the transmitted bits when an 11 bit frame is transmitted with msbf set. if msbf is set and the frame is smaller than 10 bits, only the contents of transmit buffer 0 will be transmitted. when receiving a large frame, byteswap in usartn_ctrl determines the order the way the large frame is split into the two buffer elements. if byteswap is cleared, the least significant 8 bits of the received frame are loaded into the first element of the receive buffer, and the remaining bits are loaded into the second element, as shown in figure 17.11 (p. 458 ) . the first byte read from the buffer thus contains the 8 least significant bits. set byteswap to reverse the order. the status bits are loaded into both elements of the receive buffer. the frame is not moved from the receive shift register before there are two free spaces in the receive buffer. figure 17.11. usart reception of large frames st at us rx buffer elem ent 0 rx buffer elem ent 1 shift regist er peripheral bus st at us st at us 0 1 2 3 4 5 6 7 0 1 2 0 1 2 0 1 2 3 4 5 6 7 the two buffer elements can be read at the same time using the usartn_rxdouble or usartn_rxdoublex register. rxdata0 then refers to buffer element 0 and rxdata1 refers to buffer element 1. large frames can be used in both asynchronous and synchronous modes. 17.3.2.8 multi-processor mode to simplify communication between multiple processors, the usart supports a special multi-processor mode. in this mode the 9th data bit in each frame is used to indicate whether the content of the remaining 8 bits is data or an address. when multi-processor mode is enabled, an incoming 9-bit frame with the 9th bit equal to the value of mpab in usartn_ctrl is identified as an address frame. when an address frame is detected, the
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 459 www.energymicro.com mpaf interrupt flag in usartn_if is set, and the address frame is loaded into the receive register. this happens regardless of the value of rxblock in usartn_status. multi-processor mode is enabled by setting mpm in usartn_ctrl, and the value of the 9th bit in address frames can be set in mpab. note that the receiver must be enabled for address frames to be detected. the receiver can be blocked however, preventing data from being loaded into the receive buffer while looking for address frames. example 17.1 (p. 459 ) explains basic usage of the multi-processor mode: example 17.1. usart multi-processor mode example 1. all slaves enable multi-processor mode and, enable and block the receiver. they will now not receive data unless it is an address frame. mpab in usartn_ctrl is set to identify frames with the 9th bit high as address frames. 2. the master sends a frame containing the address of a slave and with the 9th bit set. 3. all slaves receive the address frame and get an interrupt. they can read the address from the receive buffer. the selected slave unblocks the receiver to start receiving data from the master. 4. the master sends data with the 9th bit cleared. 5. only the slave with rx enabled receives the data. when transmission is complete, the slave blocks the receiver and waits for a new address frame. when a slave has received an address frame and wants to receive the following data, it must make sure the receiver is unblocked before the next frame has been completely received in order to prevent data loss. bit8dv in usartn_ctrl can be used to specify the value of the 9th bit without writing to the transmit buffer with usartn_txdatax or usartn_txdoublex, giving higher efficiency in multi-processor mode, as the 9th bit is only set when writing address frames, and 8-bit writes to the usart can be used when writing the data frames. 17.3.2.9 collision detection the usart supports a basic form of collision detection. when the receiver is connected to the output of the transmitter, either by using the loopbk bit in usartn_ctrl or through an external connection, this feature can be used to detect whether data transmitted on the bus by the usart did get corrupted by a simultaneous transmission by another device on the bus. for collision detection to be enabled, ccen in usartn_ctrl must be set, and the receiver enabled. the data sampled by the receiver is then continuously compared with the data output by the transmitter. if they differ, the ccf interrupt flag in usartn_if is set. the collision check includes all bits of the transmitted frames. the ccf interrupt flag is set once for each bit sampled by the receiver that differs from the bit output by the transmitter. when the transmitter output is disabled, i.e. the transmitter is tristated, collisions are not registered. 17.3.2.10 smartcard mode in smartcard mode, the usart supports the iso 7816 i/o line t0 mode. with exception of the stop- bits (guard time), the 7816 data frame is equal to the regular asynchronous frame. in this mode, the receiver pulls the line low for one baud, half a baud into the guard time to indicate a parity error. this nak can for instance be used by the transmitter to re-transmit the frame. smartcard mode is a half duplex asynchronous mode, so the transmitter must be tristated whenever not transmitting data. to enable smartcard mode, set scmode in usartn_ctrl, set the number of databits in a frame to 8, and configure the number of stopbits to 1.5 by writing to stopbits in usartn_frame. the smartcard mode relies on half duplex communication on a single line, so for it to work, both the receiver and transmitter must work on the same line. this can be achieved by setting loopbk in
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 460 www.energymicro.com usartn_ctrl or through an external connection. the tx output should be configured as open-drain in the gpio module. when no parity error is identified by the receiver, the data frame is as shown in figure 17.12 (p. 460 ) . the frame consists of 8 data bits, a parity bit, and 2 stop bits. the transmitter does not drive the output line during the guard time. figure 17.12. usart iso 7816 data frame without error s 0 1 2 3 4 5 6 7 p st op st art or idle st op or idle iso 7816 fram e wit hout error if a parity error is detected by the receiver, it pulls the line i/o line low after half a stop bit, see figure 17.13 (p. 460 ) . it holds the line low for one bit-period before it releases the line. in this case, the guard time is extended by one bit period before a new transmission can start, resulting in a total of 3 stop bits. figure 17.13. usart iso 7816 data frame with error s 0 1 2 3 4 5 6 7 p st op st art or idle st op or idle iso 7816 fram e wit h error st op nak on a parity error, the nak is generated by hardware. the nak generated by the receiver is sampled as the stop-bit of the frame. because of this, parity errors when in smartcard mode are reported with both a parity error and a framing error. when transmitting a t0 frame, the usart receiver on the transmitting side samples position 16, 17 and 18 in the stop-bit to detect the error signal when in 16x oversampling mode as shown in figure 17.14 (p. 461 ) . sampling at this location places the stop-bit sample in the middle of the bit-period used for the error signal (nak). if a nak is transmitted by the receiver, it will thus appear as a framing error at the transmitter, and the ferr interrupt flag in usartn_if will be set. if scretrans usartn_ctrl is set, the transmitter will automatically retransmit a nack?ed frame. the transmitter will retransmit the frame until it is ack?ed by the receiver. this only works when the number of databits in a frame is configured to 8. set skipperrf in usartn_ctrl to make the receiver discard frames with parity errors. the perr interrupt flag in usartn_if is set when a frame is discarded because of a parity error.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 461 www.energymicro.com figure 17.14. usart smartcard stop bit sampling 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 1/2 st op bit 7 8 1 2 3 4 5 6 13 7 12 ovs = 0 ovs = 1 14 15 16 8 p nak or st op 17 18 x 9 10 x x x x x x x st op 1 2 3 4 5 6 7 ovs = 2 1 2 3 4 5 x ovs = 3 8 x 6 4 for communication with a smartcard, a clock signal needs to be generated for the card. this clock output can be generated using one of the timers. see the iso 7816 specification for more info on this clock signal. smartcard t1 mode is also supported. the t1 frame format used is the same as the asynchronous frame format with parity bit enabled and one stop bit. the usart must then be configured to operate in asynchronous half duplex mode. 17.3.3 synchronous operation most of the features in asynchronous mode are available in synchronous mode. multi-processor mode can be enabled for 9-bit frames, loopback is available and collision detection can be performed. 17.3.3.1 frame format the frames used in synchronous mode need no start and stop bits since a single clock is available to all parts participating in the communication. parity bits cannot be used in synchronous mode. the usart supports frame lengths of 4 to 16 bits per frame. larger frames can be simulated by transmitting multiple smaller frames, i.e. a 22 bit frame can be sent using two 11-bit frames, and a 21 bit frame can be generated by transmitting three 7-bit frames. the number of bits in a frame is set using databits in usartn_frame. the frames in synchronous mode are by default transmitted with the least significant bit first like in asynchronous mode. the bit-order can be reversed by setting msbf in usartn_ctrl. the frame format used by the transmitter can be inverted by setting txinv in usartn_ctrl, and the format expected by the receiver can be inverted by setting rxinv, also in usartn_ctrl. 17.3.3.2 clock generation the bit-rate in synchronous mode is given by equation 17.3 (p. 461 ) . as in the case of asynchronous operation, the clock division factor have a 13-bit integral part and a 2-bit fractional part. usart synchronous mode bit rate br = f hfperclk /(2 x (1 + usartn_clkdiv/256)) (17.3) given a desired baud rate brdesired, the clock divider usartn_clkdiv can be calculated using equation 17.4 (p. 462 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 462 www.energymicro.com usart synchronous mode clock division factor usartn_clkdiv = 256 x (f hfperclk /(2 x brdesired) - 1) (17.4) when the usart operates in master mode, the highest possible bit rate is half the peripheral clock rate. when operating in slave mode however, the highest bit rate is an eighth of the peripheral clock: ? master mode: br max = f hfperclk /2 ? slave mode: br max = f hfperclk /8 on every clock edge data on the data lines, mosi and miso, is either set up or sampled. when clkpha in usartn_ctrl is cleared, data is sampled on the leading clock edge and set-up is done on the trailing edge. if clkpha is set however, data is set-up on the leading clock edge, and sampled on the trailing edge. in addition to this, the polarity of the clock signal can be changed by setting clkpol in usartn_ctrl, which also defines the idle state of the clock. this results in four different modes which are summarized in table 17.8 (p. 462 ) . figure 17.15 (p. 462 ) shows the resulting timing of data set-up and sampling relative to the bus clock. table 17.8. usart spi modes spi mode clkpol clkpha leading edge trailing edge 0 0 0 rising, sample falling, set-up 1 0 1 rising, set-up falling, sample 2 1 0 falling, sample rising, set-up 3 1 1 falling, set-up rising, sample figure 17.15. usart spi timing 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 usn_clk usn_cs usn_tx/ usn _rx clkpol = 0 clkpol = 1 clkpha = 0 clkpha = 1 x x x x if cpha=1, the tx underflow flag, txuf, will be set on the first setup clock edge of a frame in slave mode if tx data is not available. if cpha=0, txuf is set if data is not available in the transmit buffer three hfperclk cycles prior to the first sample clock edge. the rxdatav flag is updated on the last sample clock edge of a transfer, while the rx overflow interrupt flag, rxof, is set on the first sample clock edge if the receive buffer overflows. when a transfer has been performed, interrupt flags txbl and txc are updated on the first setup clock edge of the succeeding frame, or when cs is deasserted. 17.3.3.3 master mode when in master mode, the usart is in full control of the data flow on the synchronous bus. when operating in full duplex mode, the slave cannot transmit data to the master without the master transmitting to the slave. the master outputs the bus clock on usn_clk.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 463 www.energymicro.com communication starts whenever there is data in the transmit buffer and the transmitter is enabled. the usart clock then starts, and the master shifts bits out from the transmit shift register using the internal clock. when there are no more frames in the transmit buffer and the transmit shift register is empty, the clock stops, and communication ends. when the receiver is enabled, it samples data using the internal clock when the transmitter transmits data. operation of the rx and tx buffers is as in asynchronous mode. 17.3.3.3.1 operation of usn_cs pin when operating in master mode, the usn_cs pin can have one of two functions, or it can be disabled. if usn_cs is configured as an output, it can be used to automatically generate a chip select for a slave by setting autocs in usartn_ctrl. if autocs is set, usn_cs is activated when a transmission begins, and deactivated directly after the last bit has been transmitted and there is no more data in the transmit buffer. by default, usn_cs is active low, but its polarity can be inverted by setting csinv in usartn_ctrl. when usn_cs is configured as an input, it can be used by another master that wants control of the bus to make the usart release it. when usn_cs is driven low, or high if csinv is set, the interrupt flag ssm in usartn_if is set, and if csma in usartn_ctrl is set, the usart goes to slave mode. 17.3.3.3.2 autotx a synchronous master is required to transmit data to a slave in order to receive data from the slave. in some cases, only a few words are transmitted and a lot of data is then received from the slave. in that case, one solution is to keep feeding the tx with data to transmit, but that consumes system bandwidth. instead autotx can be used. when autotx in usartn_ctrl is set, the usart transmits data as long as there is available space in the rx shift register for the chosen frame size. this happens even though there is no data in the tx buffer. the tx underflow interrupt flag txuf in usartn_if is set on the first word that is transmitted which does not contain valid data. during autotx the usart will always send the previous sent bit, thus reducing the number of transitions on the tx output. so if the last bit sent was a 0, 0's will be sent during autotx and if the last bit sent was a 1, 1's will be sent during autotx. 17.3.3.3.3 synchronous master sample delay to improve speed in certain conditions by reducing the setup-time requirements for the spi slave, the master can be configured to sample the data one half sclk-cycle later, i.e. on the next setup edge, which, in spi mode 0, is the rising edge. this is enabled by setting smsdelay in usartn_ctrl and can be used together with all spi slaves that does not set up new data before the next setup edge, as the propagation delay of sclk will ensure sufficient hold time. note if used together with another energy micro chip utilizing sssearly, a very thorough understanding of the timing is required.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 464 www.energymicro.com figure 17.16. usart spi timing with smsdelay 0 1 2 3 4 5 6 7 usn_clk usn_cs usn_tx ( mosi) x x 0 1 2 3 4 5 6 7 usn_rx ( miso) x x ordinary sam ple edge sam ple edge wit h smsdelay 17.3.3.4 slave mode when the usart is in slave mode, data transmission is not controlled by the usart, but by an external master. the usart is therefore not able to initiate a transmission, and has no control over the number of bytes written to the master. the output and input to the usart are also swapped when in slave mode, making the receiver take its input from usn_tx (mosi) and the transmitter drive usn_rx (miso). to transmit data when in slave mode, the slave must load data into the transmit buffer and enable the transmitter. the data will remain in the usart until the master starts a transmission by pulling the usn_cs input of the slave low and transmitting data. for every frame the master transmits to the slave, a frame is transferred from the slave to the master. after a transmission, miso remains in the same state as the last bit transmitted. this also applies if the master transmits to the slave and the slave tx buffer is empty. if the transmitter is enabled in synchronous slave mode and the master starts transmission of a frame, the underflow interrupt flag txuf in usartn_if will be set if no data is available for transmission to the master. if the slave needs to control its own chip select signal, this can be achieved by clearing cspen in the route register. the internal chip select signal can then be controlled through csinv in the ctrl register. the chip select signal will be csinv inverted, i.e. if csinv is cleared, the chip select is active and vice versa. 17.3.3.4.1 synchronous slave setup early to improve speed in certain conditions by improving the setup time when running in slave mode, the slave can be configured to set up data one half sclk-cycle earlier, i.e. on the previous sample edge, which, for spi mode 0, is the falling edge. this is enabled by setting sssearly in usartn_ctrl and can be used with all spi masters that samples the data on the sample edge, as the sclk propagation delay will ensure sufficient hold time. note if used together with another energy micro chip utilizing smsdelay, a very thorough understanding of the timing is required.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 465 www.energymicro.com figure 17.17. usart spi slave timing with sssearly 0 1 2 3 4 5 6 7 usn_clk usn_cs usn_tx ( mosi) x x 0 1 2 3 4 5 6 7 usn_rx ( miso) x x 17.3.3.5 synchronous half duplex communication half duplex communication in synchronous mode is very similar to half duplex communication in asynchronous mode as detailed in section 17.3.2.6 (p. 455 ) . the main difference is that in this mode, the master must generate the bus clock even when it is not transmitting data, i.e. it must provide the slave with a clock to receive data. to generate the bus clock, the master should transmit data with the transmitter tristated, i.e. txtri in usartn_status set, when receiving data. if 2 bytes are expected from the slave, then transmit 2 bytes with the transmitter tristated, and the slave uses the generated bus clock to transmit data to the master. txtri can be set by setting the txtrien command bit in usartn_cmd. note when operating as spi slave in half duplex mode, tx has to be tristated (not disabled) during data reception if the slave is to transmit data in the current transfer. 17.3.3.6 i2s i2s is a synchronous format for transmission of audio data. the frame format is 32-bit, but since data is always transmitted with msb first, an i2s device operating with 16-bit audio may choose to only process the 16 msb of the frame, and only transmit data in the 16 msb of the frame. in addition to the bit clock used for regular synchronous transfers, i2s mode uses a separate word clock. when operating in mono mode, with only one channel of data, the word clock pulses once at the start of each new word. in stereo mode, the word clock toggles at the start of new words, and also gives away whether the transmitted word is for the left or right audio channel; a word transmitted while the word clock is low is for the left channel, and a word transmitted while the word clock is high is for the right. when operating in i2s mode, the cs pin is used as a the word clock. in master mode, this is automatically driven by the usart, and in slave mode, the word clock is expected from an external master. 17.3.3.6.1 word format the general i2s word format is 32 bits wide, but the usart also supports 16-bit and 8-bit words. in addition to this, it can be specified how many bits of the word should actually be used by the usart. these parameters are given by format in usartn_i2sctrl. as an example, configuring format to using a 32-bit word with 16-bit data will make each word on the i2s bus 32-bits wide, but when receiving data through the usart, only the 16 most significant bits of each word can be read out of the usart. similarly, only the 16 most significant bits have to be written to the usart when transmitting. the rest of the bits will be transmitted as zeroes. 17.3.3.6.2 major modes the usart supports a set of different i2s formats as shown in table 17.9 (p. 466 ) , but it is not limited to these modes. mono, justify and delay in usartn_i2sctrl can be mixed and matched to
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 466 www.energymicro.com create an appropriate format. mono enables mono mode, i.e. one data stream instead of two which is the default. justify aligns data within a word on the i2s bus, either left or right which can bee seen in figures figure 17.20 (p. 467 ) and figure 17.21 (p. 467 ) . finally, delay specifies whether a new i2s word should be started directly on the edge of the word-select signal, or one bit-period after the edge. table 17.9. usart i2s modes mode mono justify delay clkpol regular i2s 0 0 1 0 left-justified 0 0 0 1 right-justified 0 1 0 1 mono 1 0 0 0 the regular i2s waveform is shown in figure 17.18 (p. 466 ) and figure 17.19 (p. 466 ) . the first figure shows a waveform transmitted with full accuracy. the wordlength can be configured to 32-bit, 16-bit or 8-bit using format in usartn_i2sctrl. in the second figure, i2s data is transmitted with reduced accuracy, i.e. the data transmitted has less bits than what is possible in the bus format. note that the msb of a word transmitted in regular i2s mode is delayed by one cycle with respect to word select figure 17.18. usart standard i2s waveform usn_clk usn_cs ( word select ) usn_tx/ usn _rx msb left channel right channel right channel lsb msb lsb figure 17.19. usart standard i2s waveform (reduced accuracy) usn_clk usn_cs ( word select ) usn_tx/ usn _rx msb left channel right channel right channel lsb msb a left-justified stream is shown in figure 17.20 (p. 467 ) . note that the msb comes directly after the edge on the word-select signal in contradiction to the regular i2s waveform where it comes one bit- period after.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 467 www.energymicro.com figure 17.20. usart left-justified i2s waveform usn_clk usn_cs ( word select ) usn_tx/ usn _rx msb left channel right channel right channel lsb msb a right-justified stream is shown in figure 17.21 (p. 467 ) . the left and right justified streams are equal when the data-size is equal to the word-width. figure 17.21. usart right-justified i2s waveform usn_clk usn_tx/ usn _rx msb left channel right channel right channel lsb lsb in mono-mode, the word-select signal pulses at the beginning of each word instead of toggling for each word. mono i2s waveform is shown in figure 17.22 (p. 467 ) . figure 17.22. usart mono i2s waveform usn_clk usn_cs ( word select ) usn_tx/ usn _rx msb left channel right channel right channel lsb msb 17.3.3.6.3 using i2s mode when using the usart in i2s mode, databits in usartn_frame must be set to 8 or 16 data-bits. 8 databits can be used in all modes, and 16 can be used in the modes where the number of bytes in the i2s word is even. in addition to this, msbf in usartn_ctrl should be set, and clkpol and clkpha in usartn_ctrl should be cleared. the usart does not have separate tx and rx buffers for left and right data, so when using i2s in stereo mode, the application must keep track of whether the buffers contain left or right data. this can be done by observing txblright, rxdatavright and rxfullright in usartn_status. txblright
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 468 www.energymicro.com tells whether tx is expecting data for the left or right channel. it will be set with txbl if right data is expected. the receiver will set rxdatavright if there is at least one right element in the buffer, and rxfullright if the buffer is full of right elements. when using i2s with dma, separate dma requests can be used for left and right data by setting dmasplit in usartn_i2sctrl. in both master and slave mode the usart always starts transmitting on the left channel after being enabled. in master mode, the transmission will stop if tx becomes empty. in that case, txc is set. continuing the transmission in this case will make the data-stream continue where it left off. to make the usart start on the left channel after going empty, disable and re-enable tx. 17.3.4 prs-triggered transmissions if a transmission must be started on an event with very little delay, the prs system can be used to trigger the transmission. the prs channel to use as a trigger can be selected using tsel in usartn_trigctrl. when a positive edge is detected on this signal, the receiver is enabled if rxten in usartn_trigctrl is set, and the transmitter is enabled if txten in usartn_trigctrl is set. only one signal input is supported by the usart. the autotx feature can also be enabled via prs. if an external spi device sets a pin high when there is data to be read from the device, this signal can be routed to the usart through the prs system and be used to make the usart clock data out of the external device. if autotxten in usartn_trigctrl is set, the usart will transmit data whenever the prs signal selected by tsel is high given that there is enough room in the rx buffer for the chosen frame size. note that if there is no data in the tx buffer when using autotx, the tx underflow interrupt will be set. autotxten can also be combined with txten to make the usart transmit a command to the external device prior to clocking out data. to do this, disable tx using the txdis command, load the tx buffer with the command and enable autotxten and txten. when the selected prs input goes high, the usart will now transmit the loaded command, and then continue clocking out while both the prs input is high and there is room in the rx buffer 17.3.5 prs rx input the usart can be configured to receive data directly from a prs channel by setting rxprs in usartn_input. the prs channel used is selected using rxprssel in usartn_input. this way, for example, a differential rx signal can be input to the acmp and the output routed via prs to the usart. 17.3.6 dma support the usart has full dma support. the dma controller can write to the transmit buffer using the registers usartn_txdata, usartn_txdatax, usartn_txdouble and usartn_txdoublex, and it can read from the receive buffer using the registers usartn_rxdata, usartn_rxdatax, usartn_rxdouble and usartn_rxdoublex. this enables single byte transfers, 9 bit data + control/status bits, double byte and double byte + control/status transfers both to and from the usart. a request for the dma controller to read from the usart receive buffer can come from the following source: ? data available in the receive buffer. ? data available in the receive buffer and data is for the right i2s channel. only used in i2s mode. a write request can come from one of the following sources: ? transmit buffer and shift register empty. no data to send. ? transmit buffer has room for more data.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 469 www.energymicro.com ? transmit buffer has room for right i2s data. only used in i2s mode. even though there are two sources for write requests to the dma, only one should be used at a time, since the requests from both sources are cleared even though only one of the requests are used. in some cases, it may be sensible to temporarily stop dma access to the usart when an error such as a framing error has occurred. this is enabled by setting errsdma in usartn_ctrl. 17.3.7 transmission delay by configuring txdelay in usartn_ctrl, the transmitter can be forced to wait a number of bit- periods from it is ready to transmit data, to it actually transmits the data. this delay is only applied to the first frame transmitted after the transmitter has been idle. when transmitting frames back-to-back the delay is not introduced between the transmitted frames. this is useful on half duplex buses, because the receiver always returns received frames to software during the first stop-bit. the bus may still be driven for up to 3 baud periods, depending on the current frame format. using the transmission delay, a transmission can be started when a frame is received, and it is possible to make sure that the transmitter does not begin driving the output before the frame on the bus is completely transmitted. txdelay in usartn_ctrl only applies to asynchronous transmission. 17.3.8 interrupts the interrupts generated by the usart are combined into two interrupt vectors. interrupts related to reception are assigned to one interrupt vector, and interrupts related to transmission are assigned to the other. separating the interrupts in this way allows different priorities to be set for transmission and reception interrupts. the transmission interrupt vector groups the transmission-related interrupts generated by the following interrupt flags: ? txc ? txbl ? txof ? ccf the reception interrupt on the other hand groups the reception-related interrupts, triggered by the following interrupt flags: ? rxdatav ? rxfull ? rxof ? rxuf ? perr ? ferr ? mpaf ? ssm if usart interrupts are enabled, an interrupt will be made if one or more of the interrupt flags in usart_if and their corresponding bits in usart_ien are set. 17.3.9 irda modulator/demodulator the irda modulator on usart0 implements the physical layer of the irda specification, which is necessary for communication over irda. the modulator takes the signal output from the usart module,
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 470 www.energymicro.com and modulates it before it leaves usart0. in the same way, the input signal is demodulated before it enters the actual usart module. the modulator is only available on usart0, and implements the original rev. 1.0 physical layer and one high speed extension which supports speeds from 2.4 kbps to 1.152 mbps. the data from and to the usart is represented in a nrz (non return to zero) format, where the signal value is at the same level through the entire bit period. for irda, the required format is rzi (return to zero inverted), a format where a ?1? is signalled by holding the line low, and a ?0? is signalled by a short high pulse. an example is given in figure 17.23 (p. 470 ) . figure 17.23. usart example rzi signal for a given asynchronous usart frame s 0 1 2 3 4 5 6 7 p st op idle idle usart ( nrz) irda ( rzi) the irda module is enabled by setting iren. the usart transmitter output and receiver input is then routed through the irda modulator. the width of the pulses generated by the irda modulator is set by configuring irpw in usartn_irctrl. four pulse widths are available, each defined relative to the configured bit period as listed in table 17.10 (p. 470 ) . table 17.10. usart irda pulse widths irpw pulse width ovs=0 pulse width ovs=1 pulse width ovs=2 pulse width ovs=3 00 1/16 1/8 1/6 1/4 01 2/16 2/8 2/6 n/a 10 3/16 3/8 n/a n/a 11 4/16 n/a n/a n/a by default, no filter is enabled in the irda demodulator. a filter can be enabled by setting irfilt in usartn_irctrl. when the filter is enabled, an incoming pulse has to last for 4 consecutive clock cycles to be detected by the irda demodulator. note that by default, the idle value of the usart data signal is high. this means that the irda modulator generates negative pulses, and the irda demodulator expects negative pulses. to make the irda module use rzi signalling, both txinv and rxinv in usartn_ctrl must be set. the irda module can also modulate a signal from the prs system, and transmit a modulated signal to the prs system. to use a prs channel as transmitter source instead of the usart, set irprsen in usartn_irctrl high. the channel is selected by configuring irprssel in usartn_irctrl.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 471 www.energymicro.com 17.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 usartn_ctrl rw control register 0x004 usartn_frame rw usart frame format register 0x008 usartn_trigctrl rw usart trigger control register 0x00c usartn_cmd w1 command register 0x010 usartn_status r usart status register 0x014 usartn_clkdiv rw clock control register 0x018 usartn_rxdatax r rx buffer data extended register 0x01c usartn_rxdata r rx buffer data register 0x020 usartn_rxdoublex r rx buffer double data extended register 0x024 usartn_rxdouble r rx fifo double data register 0x028 usartn_rxdataxp r rx buffer data extended peek register 0x02c usartn_rxdoublexp r rx buffer double data extended peek register 0x030 usartn_txdatax w tx buffer data extended register 0x034 usartn_txdata w tx buffer data register 0x038 usartn_txdoublex w tx buffer double data extended register 0x03c usartn_txdouble w tx buffer double data register 0x040 usartn_if r interrupt flag register 0x044 usartn_ifs w1 interrupt flag set register 0x048 usartn_ifc w1 interrupt flag clear register 0x04c usartn_ien rw interrupt enable register 0x050 usartn_irctrl rw irda control register 0x054 usartn_route rw i/o routing register 0x058 usartn_input rw usart input register 0x05c usartn_i2sctrl rw i2s control register 17.5 register description 17.5.1 usartn_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0x0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name smsdelay mvdis autotx byteswap txdelay sssearly errstx errsrx errsdma bit8dv skipperrf scretrans scmode autotri autocs csinv txinv rxinv txbil csma msbf clkpha clkpol ovs mpab mpm ccen loopbk sync bit name reset access description 31 smsdelay 0 rw synchronous master sample delay delay synchronous master sample point to the next setup edge to improve timing and allow communication at higher speeds. 30 mvdis 0 rw majority vote disable disable majority vote for 16x, 8x and 6x oversampling modes.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 472 www.energymicro.com bit name reset access description 29 autotx 0 rw always transmit when rx not full transmits as long as rx is not full. if tx is empty, underflows are generated. 28 byteswap 0 rw byteswap in double accesses set to switch the order of the bytes in double accesses. value description 0 normal byte order 1 byte order swapped 27:26 txdelay 0x0 rw tx delay transmission configurable delay before new transfers. frames sent back-to-back are not delayed. value mode description 0 none frames are transmitted immediately 1 single transmission of new frames are delayed by a single baud period 2 double transmission of new frames are delayed by two baud periods 3 triple transmission of new frames are delayed by three baud periods 25 sssearly 0 rw synchronous slave setup early setup data on sample edge in synchronous slave mode to improve mosi setup time. 24 errstx 0 rw disable tx on error when set, the transmitter is disabled on framing and parity errors (asynchronous mode only) in the receiver. value description 0 received framing and parity errors have no effect on transmitter 1 received framing and parity errors disable the transmitter 23 errsrx 0 rw disable rx on error when set, the receiver is disabled on framing and parity errors (asynchronous mode only). value description 0 framing and parity errors have no effect on receiver 1 framing and parity errors disable the receiver 22 errsdma 0 rw halt dma on error when set, dma requests will be cleared on framing and parity errors (asynchronous mode only). value description 0 framing and parity errors have no effect on dma requests from the usart 1 dma requests from the usart are blocked while the perr or ferr interrupt flags are set 21 bit8dv 0 rw bit 8 default value the default value of the 9th bit. if 9-bit frames are used, and an 8-bit write operation is done, leaving the 9th bit unspecified, the 9th bit is set to the value of bit8dv. 20 skipperrf 0 rw skip parity error frames when set, the receiver discards frames with parity errors (asynchronous mode only). the perr interrupt flag is still set. 19 scretrans 0 rw smartcard retransmit when in smartcard mode, a nack'ed frame will be kept in the shift register and retransmitted if the transmitter is still enabled. 18 scmode 0 rw smartcard mode use this bit to enable or disable smartcard mode. 17 autotri 0 rw automatic tx tristate when enabled, txtri is set by hardware whenever the transmitter is idle, and txtri is cleared by hardware when transmission starts. value description 0 the output on u(s)n_tx when the transmitter is idle is defined by txinv 1 u(s)n_tx is tristated whenever the transmitter is idle 16 autocs 0 rw automatic chip select
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 473 www.energymicro.com bit name reset access description when enabled, the output on usn_cs will be activated one baud-period before transmission starts, and deactivated when transmission ends. 15 csinv 0 rw chip select invert default value is active low. this affects both the selection of external slaves, as well as the selection of the microcontroller as a slave. value description 0 chip select is active low 1 chip select is active high 14 txinv 0 rw transmitter output invert the output from the usart transmitter can optionally be inverted by setting this bit. value description 0 output from the transmitter is passed unchanged to u(s)n_tx 1 output from the transmitter is inverted before it is passed to u(s)n_tx 13 rxinv 0 rw receiver input invert setting this bit will invert the input to the usart receiver. value description 0 input is passed directly to the receiver 1 input is inverted before it is passed to the receiver 12 txbil 0 rw tx buffer interrupt level determines the interrupt and status level of the transmit buffer. value mode description 0 empty txbl and the txbl interrupt flag are set when the transmit buffer becomes empty. txbl is cleared when the buffer becomes nonempty. 1 halffull txbl and txblif are set when the transmit buffer goes from full to half-full or empty. txbl is cleared when the buffer becomes full. 11 csma 0 rw action on slave-select in master mode this register determines the action to be performed when slave-select is configured as an input and driven low while in master mode. value mode description 0 noaction no action taken 1 gotoslavemode go to slave mode 10 msbf 0 rw most significant bit first decides whether data is sent with the least significant bit first, or the most significant bit first. value description 0 data is sent with the least significant bit first 1 data is sent with the most significant bit first 9 clkpha 0 rw clock edge for setup/sample determines where data is set-up and sampled according to the bus clock when in synchronous mode. value mode description 0 sampleleading data is sampled on the leading edge and set-up on the trailing edge of the bus clock in synchronous mode 1 sampletrailing data is set-up on the leading edge and sampled on the trailing edge of the bus clock in synchronous mode 8 clkpol 0 rw clock polarity determines the clock polarity of the bus clock used in synchronous mode. value mode description 0 idlelow the bus clock used in synchronous mode has a low base value 1 idlehigh the bus clock used in synchronous mode has a high base value 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:5 ovs 0x0 rw oversampling
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 474 www.energymicro.com bit name reset access description sets the number of clock periods in a uart bit-period. more clock cycles gives better robustness, while less clock cycles gives better performance. value mode description 0 x16 regular uart mode with 16x oversampling in asynchronous mode 1 x8 double speed with 8x oversampling in asynchronous mode 2 x6 6x oversampling in asynchronous mode 3 x4 quadruple speed with 4x oversampling in asynchronous mode 4 mpab 0 rw multi-processor address-bit defines the value of the multi-processor address bit. an incoming frame with its 9th bit equal to the value of this bit marks the frame as a multi-processor address frame. 3 mpm 0 rw multi-processor mode multi-processor mode uses the 9th bit of the usart frames to tell whether the frame is an address frame or a data frame. value description 0 the 9th bit of incoming frames has no special function 1 an incoming frame with the 9th bit equal to mpab will be loaded into the receive buffer regardless of rxblock and will result in the mpab interrupt flag being set 2 ccen 0 rw collision check enable enables collision checking on data when operating in half duplex modus. value description 0 collision check is disabled 1 collision check is enabled. the receiver must be enabled for the check to be performed 1 loopbk 0 rw loopback enable allows the receiver to be connected directly to the usart transmitter for loopback and half duplex communication. value description 0 the receiver is connected to and receives data from u(s)n_rx 1 the receiver is connected to and receives data from u(s)n_tx 0 sync 0 rw usart synchronous mode determines whether the usart is operating in asynchronous or synchronous mode. value description 0 the usart operates in asynchronous mode 1 the usart operates in synchronous mode 17.5.2 usartn_frame - usart frame format register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x1 0x0 0x5 access rw rw rw name stopbits parity databits bit name reset access description 31:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:12 stopbits 0x1 rw stop-bit mode determines the number of stop-bits used. value mode description 0 half the transmitter generates a half stop bit. stop-bits are not verified by receiver
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 475 www.energymicro.com bit name reset access description value mode description 1 one one stop bit is generated and verified 2 oneandahalf the transmitter generates one and a half stop bit. the receiver verifies the first stop bit 3 two the transmitter generates two stop bits. the receiver checks the first stop-bit only 11:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:8 parity 0x0 rw parity-bit mode determines whether parity bits are enabled, and whether even or odd parity should be used. only available in asynchronous mode. value mode description 0 none parity bits are not used 2 even even parity are used. parity bits are automatically generated and checked by hardware. 3 odd odd parity is used. parity bits are automatically generated and checked by hardware. 7:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 databits 0x5 rw data-bit mode this register sets the number of data bits in a usart frame. value mode description 1 four each frame contains 4 data bits 2 five each frame contains 5 data bits 3 six each frame contains 6 data bits 4 seven each frame contains 7 data bits 5 eight each frame contains 8 data bits 6 nine each frame contains 9 data bits 7 ten each frame contains 10 data bits 8 eleven each frame contains 11 data bits 9 twelve each frame contains 12 data bits 10 thirteen each frame contains 13 data bits 11 fourteen each frame contains 14 data bits 12 fifteen each frame contains 15 data bits 13 sixteen each frame contains 16 data bits 17.5.3 usartn_trigctrl - usart trigger control register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0x0 access rw rw rw rw name autotxten txten rxten tsel bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 autotxten 0 rw autotx trigger enable when set, autotx is enabled as long as the prs channel selected by tsel has a high value. 5 txten 0 rw transmit trigger enable when set, the prs channel selected by tsel sets txen, enabling the transmitter on positive trigger edges. 4 rxten 0 rw receive trigger enable when set, the prs channel selected by tsel sets rxen, enabling the receiver on positive trigger edges.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 476 www.energymicro.com bit name reset access description 3:0 tsel 0x0 rw trigger prs channel select select usart prs trigger channel. the prs signal can enable rx and/or tx, depending on the setting of rxten and txten. value mode description 0 prsch0 prs channel 0 selected 1 prsch1 prs channel 1 selected 2 prsch2 prs channel 2 selected 3 prsch3 prs channel 3 selected 4 prsch4 prs channel 4 selected 5 prsch5 prs channel 5 selected 6 prsch6 prs channel 6 selected 7 prsch7 prs channel 7 selected 8 prsch8 prs channel 8 selected 9 prsch9 prs channel 9 selected 10 prsch10 prs channel 10 selected 11 prsch11 prs channel 11 selected 17.5.4 usartn_cmd - command register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name clearrx cleartx txtridis txtrien rxblockdis rxblocken masterdis masteren txdis txen rxdis rxen bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 clearrx 0 w1 clear rx set to clear receive buffer and the rx shift register. 10 cleartx 0 w1 clear tx set to clear transmit buffer and the tx shift register. 9 txtridis 0 w1 transmitter tristate disable disables tristating of the transmitter output. 8 txtrien 0 w1 transmitter tristate enable tristates the transmitter output. 7 rxblockdis 0 w1 receiver block disable set to clear rxblock, resulting in all incoming frames being loaded into the receive buffer. 6 rxblocken 0 w1 receiver block enable set to set rxblock, resulting in all incoming frames being discarded. 5 masterdis 0 w1 master disable set to disable master mode, clearing the master status bit and putting the usart in slave mode. 4 masteren 0 w1 master enable set to enable master mode, setting the master status bit. master mode should not be enabled while txens is set to 1. to enable both master and tx mode, write masteren before txen, or enable them both in the same write operation. 3 txdis 0 w1 transmitter disable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 477 www.energymicro.com bit name reset access description set to disable transmission. 2 txen 0 w1 transmitter enable set to enable data transmission. 1 rxdis 0 w1 receiver disable set to disable data reception. if a frame is under reception when the receiver is disabled, the incoming frame is discarded. 0 rxen 0 w1 receiver enable set to activate data reception on u(s)n_rx. 17.5.5 usartn_status - usart status register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 1 0 0 0 0 0 0 access r r r r r r r r r r r r r name rxfullright rxdatavright txbsright txbdright rxfull rxdatav txbl txc txtri rxblock master txens rxens bit name reset access description 31:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 rxfullright 0 r rx full of right data when set, the entire rx buffer contains right data. only used in i2s mode. 11 rxdatavright 0 r rx data right when set, reading rxdata or rxdatax gives right data. else left data is read. only used in i2s mode. 10 txbsright 0 r tx buffer expects single right data when set, the tx buffer expects at least a single right data. else it expects left data. only used in i2s mode. 9 txbdright 0 r tx buffer expects double right data when set, the tx buffer expects double right data. else it may expect a single right data or left data. only used in i2s mode. 8 rxfull 0 r rx fifo full set when the rxfifo is full. cleared when the receive buffer is no longer full. when this bit is set, there is still room for one more frame in the receive shift register. 7 rxdatav 0 r rx data valid set when data is available in the receive buffer. cleared when the receive buffer is empty. 6 txbl 1 r tx buffer level indicates the level of the transmit buffer. if txbil is cleared, txbl is set whenever the transmit buffer is empty, and if txbil is set, txbl is set whenever the transmit buffer is half-full or empty. 5 txc 0 r tx complete set when a transmission has completed and no more data is available in the transmit buffer and shift register. cleared when data is written to the transmit buffer. 4 txtri 0 r transmitter tristated set when the transmitter is tristated, and cleared when transmitter output is enabled. if autotri in usartn_ctrl is set this bit is always read as 0. 3 rxblock 0 r block incoming data when set, the receiver discards incoming frames. an incoming frame will not be loaded into the receive buffer if this bit is set at the instant the frame has been completely received.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 478 www.energymicro.com bit name reset access description 2 master 0 r spi master mode set when the usart operates as a master. set using the masteren command and clear using the masterdis command. 1 txens 0 r transmitter enable status set when the transmitter is enabled. 0 rxens 0 r receiver enable status set when the receiver is enabled. 17.5.6 usartn_clkdiv - clock control register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name div bit name reset access description 31:21 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 20:6 div 0x0000 rw fractional clock divider specifies the fractional clock divider for the usart. 5:0 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17.5.7 usartn_rxdatax - rx buffer data extended register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x000 access r r r name ferr perr rxdata bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 ferr 0 r data framing error set if data in buffer has a framing error. can be the result of a break condition. 14 perr 0 r data parity error set if data in buffer has a parity error (asynchronous mode only).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 479 www.energymicro.com bit name reset access description 13:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 rxdata 0x000 r rx data use this register to access data read from the usart. buffer is cleared on read access. 17.5.8 usartn_rxdata - rx buffer data register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access r name rxdata bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 rxdata 0x00 r rx data use this register to access data read from usart. buffer is cleared on read access. only the 8 lsb can be read using this register. 17.5.9 usartn_rxdoublex - rx buffer double data extended register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x000 0 0 0x000 access r r r r r r name ferr1 perr1 rxdata1 ferr0 perr0 rxdata0 bit name reset access description 31 ferr1 0 r data framing error 1 set if data in buffer has a framing error. can be the result of a break condition. 30 perr1 0 r data parity error 1 set if data in buffer has a parity error (asynchronous mode only). 29:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24:16 rxdata1 0x000 r rx data 1 second frame read from buffer. 15 ferr0 0 r data framing error 0 set if data in buffer has a framing error. can be the result of a break condition. 14 perr0 0 r data parity error 0 set if data in buffer has a parity error (asynchronous mode only).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 480 www.energymicro.com bit name reset access description 13:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 rxdata0 0x000 r rx data 0 first frame read from buffer. 17.5.10 usartn_rxdouble - rx fifo double data register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x00 access r r name rxdata1 rxdata0 bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:8 rxdata1 0x00 r rx data 1 second frame read from buffer. 7:0 rxdata0 0x00 r rx data 0 first frame read from buffer. 17.5.11 usartn_rxdataxp - rx buffer data extended peek register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x000 access r r r name ferrp perrp rxdatap bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 ferrp 0 r data framing error peek set if data in buffer has a framing error. can be the result of a break condition. 14 perrp 0 r data parity error peek set if data in buffer has a parity error (asynchronous mode only). 13:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 rxdatap 0x000 r rx data peek use this register to access data read from the usart.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 481 www.energymicro.com 17.5.12 usartn_rxdoublexp - rx buffer double data extended peek register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x000 0 0 0x000 access r r r r r r name ferrp1 perrp1 rxdatap1 ferrp0 perrp0 rxdatap0 bit name reset access description 31 ferrp1 0 r data framing error 1 peek set if data in buffer has a framing error. can be the result of a break condition. 30 perrp1 0 r data parity error 1 peek set if data in buffer has a parity error (asynchronous mode only). 29:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24:16 rxdatap1 0x000 r rx data 1 peek second frame read from fifo. 15 ferrp0 0 r data framing error 0 peek set if data in buffer has a framing error. can be the result of a break condition. 14 perrp0 0 r data parity error 0 peek set if data in buffer has a parity error (asynchronous mode only). 13:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 rxdatap0 0x000 r rx data 0 peek first frame read from fifo. 17.5.13 usartn_txdatax - tx buffer data extended register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0x000 access w w w w w w name rxenat txdisat txbreak txtriat ubrxat txdatax bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 rxenat 0 w enable rx after transmission set to enable reception after transmission. 14 txdisat 0 w clear txen after transmission
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 482 www.energymicro.com bit name reset access description set to disable transmitter and release data bus directly after transmission. 13 txbreak 0 w transmit data as break set to send data as a break. recipient will see a framing error or a break condition depending on its configuration and the value of wdata. 12 txtriat 0 w set txtri after transmission set to tristate transmitter by setting txtri after transmission. 11 ubrxat 0 w unblock rx after transmission set clear rxblock after transmission, unblocking the receiver. 10:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 txdatax 0x000 w tx data use this register to write data to the usart. if txen is set, a transfer will be initiated at the first opportunity. 17.5.14 usartn_txdata - tx buffer data register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access w name txdata bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 txdata 0x00 w tx data this frame will be added to tx buffer. only 8 lsb can be written using this register. 9th bit and control bits will be cleared. 17.5.15 usartn_txdoublex - tx buffer double data extended register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0x000 0 0 0 0 0 0x000 access w w w w w w w w w w w w name rxenat1 txdisat1 txbreak1 txtriat1 ubrxat1 txdata1 rxenat0 txdisat0 txbreak0 txtriat0 ubrxat0 txdata0 bit name reset access description 31 rxenat1 0 w enable rx after transmission set to enable reception after transmission. 30 txdisat1 0 w clear txen after transmission
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 483 www.energymicro.com bit name reset access description set to disable transmitter and release data bus directly after transmission. 29 txbreak1 0 w transmit data as break set to send data as a break. recipient will see a framing error or a break condition depending on its configuration and the value of usartn_wdata. 28 txtriat1 0 w set txtri after transmission set to tristate transmitter by setting txtri after transmission. 27 ubrxat1 0 w unblock rx after transmission set clear rxblock after transmission, unblocking the receiver. 26:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24:16 txdata1 0x000 w tx data second frame to write to fifo. 15 rxenat0 0 w enable rx after transmission set to enable reception after transmission. 14 txdisat0 0 w clear txen after transmission set to disable transmitter and release data bus directly after transmission. 13 txbreak0 0 w transmit data as break set to send data as a break. recipient will see a framing error or a break condition depending on its configuration and the value of wdata. 12 txtriat0 0 w set txtri after transmission set to tristate transmitter by setting txtri after transmission. 11 ubrxat0 0 w unblock rx after transmission set clear rxblock after transmission, unblocking the receiver. 10:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 txdata0 0x000 w tx data first frame to write to buffer. 17.5.16 usartn_txdouble - tx buffer double data register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x00 access w w name txdata1 txdata0 bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:8 txdata1 0x00 w tx data second frame to write to buffer. 7:0 txdata0 0x00 w tx data first frame to write to buffer.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 484 www.energymicro.com 17.5.17 usartn_if - interrupt flag register offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 1 0 access r r r r r r r r r r r r r name ccf ssm mpaf ferr perr txuf txof rxuf rxof rxfull rxdatav txbl txc bit name reset access description 31:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 ccf 0 r collision check fail interrupt flag set when a collision check notices an error in the transmitted data. 11 ssm 0 r slave-select in master mode interrupt flag set when the device is selected as a slave when in master mode. 10 mpaf 0 r multi-processor address frame interrupt flag set when a multi-processor address frame is detected. 9 ferr 0 r framing error interrupt flag set when a frame with a framing error is received while rxblock is cleared. 8 perr 0 r parity error interrupt flag set when a frame with a parity error (asynchronous mode only) is received while rxblock is cleared. 7 txuf 0 r tx underflow interrupt flag set when operating as a synchronous slave, no data is available in the transmit buffer when the master starts transmission of a new frame. 6 txof 0 r tx overflow interrupt flag set when a write is done to the transmit buffer while it is full. the data already in the transmit buffer is preserved. 5 rxuf 0 r rx underflow interrupt flag set when trying to read from the receive buffer when it is empty. 4 rxof 0 r rx overflow interrupt flag set when data is incoming while the receive shift register is full. the data previously in the shift register is lost. 3 rxfull 0 r rx buffer full interrupt flag set when the receive buffer becomes full. 2 rxdatav 0 r rx data valid interrupt flag set when data becomes available in the receive buffer. 1 txbl 1 r tx buffer level interrupt flag set when buffer becomes empty if txbil is set, or when buffer goes from full to half-full if txbil is cleared. 0 txc 0 r tx complete interrupt flag this interrupt is used after a transmission when both the tx buffer and shift register are empty.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 485 www.energymicro.com 17.5.18 usartn_ifs - interrupt flag set register offset bit position 0x044 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name ccf ssm mpaf ferr perr txuf txof rxuf rxof rxfull txc bit name reset access description 31:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 ccf 0 w1 set collision check fail interrupt flag write to 1 to set the ccf interrupt flag. 11 ssm 0 w1 set slave-select in master mode interrupt flag write to 1 to set the ssm interrupt flag. 10 mpaf 0 w1 set multi-processor address frame interrupt flag write to 1 to set the mpaf interrupt flag. 9 ferr 0 w1 set framing error interrupt flag write to 1 to set the ferr interrupt flag. 8 perr 0 w1 set parity error interrupt flag write to 1 to set the perr interrupt flag. 7 txuf 0 w1 set tx underflow interrupt flag write to 1 to set the txuf interrupt flag. 6 txof 0 w1 set tx overflow interrupt flag write to 1 to set the txof interrupt flag. 5 rxuf 0 w1 set rx underflow interrupt flag write to 1 to set the rxuf interrupt flag. 4 rxof 0 w1 set rx overflow interrupt flag write to 1 to set the rxof interrupt flag. 3 rxfull 0 w1 set rx buffer full interrupt flag write to 1 to set the rxfull interrupt flag. 2:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 txc 0 w1 set tx complete interrupt flag write to 1 to set the txc interrupt flag. 17.5.19 usartn_ifc - interrupt flag clear register offset bit position 0x048 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name ccf ssm mpaf ferr perr txuf txof rxuf rxof rxfull txc
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 486 www.energymicro.com bit name reset access description 31:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 ccf 0 w1 clear collision check fail interrupt flag write to 1 to clear the ccf interrupt flag. 11 ssm 0 w1 clear slave-select in master mode interrupt flag write to 1 to clear the ssm interrupt flag. 10 mpaf 0 w1 clear multi-processor address frame interrupt flag write to 1 to clear the mpaf interrupt flag. 9 ferr 0 w1 clear framing error interrupt flag write to 1 to clear the ferr interrupt flag. 8 perr 0 w1 clear parity error interrupt flag write to 1 to clear the perr interrupt flag. 7 txuf 0 w1 clear tx underflow interrupt flag write to 1 to clear the txuf interrupt flag. 6 txof 0 w1 clear tx overflow interrupt flag write to 1 to clear the txof interrupt flag. 5 rxuf 0 w1 clear rx underflow interrupt flag write to 1 to clear the rxuf interrupt flag. 4 rxof 0 w1 clear rx overflow interrupt flag write to 1 to clear the rxof interrupt flag. 3 rxfull 0 w1 clear rx buffer full interrupt flag write to 1 to clear the rxfull interrupt flag. 2:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 txc 0 w1 clear tx complete interrupt flag write to 1 to clear the txc interrupt flag. 17.5.20 usartn_ien - interrupt enable register offset bit position 0x04c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw name ccf ssm mpaf ferr perr txuf txof rxuf rxof rxfull rxdatav txbl txc bit name reset access description 31:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 ccf 0 rw collision check fail interrupt enable enable interrupt on collision check error detected. 11 ssm 0 rw slave-select in master mode interrupt enable enable interrupt on slave-select in master mode. 10 mpaf 0 rw multi-processor address frame interrupt enable enable interrupt on multi-processor address frame. 9 ferr 0 rw framing error interrupt enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 487 www.energymicro.com bit name reset access description enable interrupt on framing error. 8 perr 0 rw parity error interrupt enable enable interrupt on parity error (asynchronous mode only). 7 txuf 0 rw tx underflow interrupt enable enable interrupt on tx underflow. 6 txof 0 rw tx overflow interrupt enable enable interrupt on tx overflow. 5 rxuf 0 rw rx underflow interrupt enable enable interrupt on rx underflow. 4 rxof 0 rw rx overflow interrupt enable enable interrupt on rx overflow. 3 rxfull 0 rw rx buffer full interrupt enable enable interrupt on rx buffer full. 2 rxdatav 0 rw rx data valid interrupt enable enable interrupt on rx data. 1 txbl 0 rw tx buffer level interrupt enable enable interrupt on tx buffer level. 0 txc 0 rw tx complete interrupt enable enable interrupt on tx complete. 17.5.21 usartn_irctrl - irda control register offset bit position 0x050 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 0 0x0 0 access rw rw rw rw rw name irprsen irprssel irfilt irpw iren bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 irprsen 0 rw irda prs channel enable enable the prs channel selected by irprssel as input to irda module instead of tx. 6:4 irprssel 0x0 rw irda prs channel select a prs can be used as input to the pulse modulator instead of tx. this value selects the channel to use. value mode description 0 prsch0 prs channel 0 selected 1 prsch1 prs channel 1 selected 2 prsch2 prs channel 2 selected 3 prsch3 prs channel 3 selected 4 prsch4 prs channel 4 selected 5 prsch5 prs channel 5 selected 6 prsch6 prs channel 6 selected 7 prsch7 prs channel 7 selected 3 irfilt 0 rw irda rx filter
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 488 www.energymicro.com bit name reset access description set to enable filter on irda demodulator. value description 0 no filter enabled 1 filter enabled. irda pulse must be high for at least 4 consecutive clock cycles to be detected 2:1 irpw 0x0 rw irda tx pulse width configure the pulse width generated by the irda modulator as a fraction of the configured usart bit period. value mode description 0 one irda pulse width is 1/16 for ovs=0 and 1/8 for ovs=1 1 two irda pulse width is 2/16 for ovs=0 and 2/8 for ovs=1 2 three irda pulse width is 3/16 for ovs=0 and 3/8 for ovs=1 3 four irda pulse width is 4/16 for ovs=0 and 4/8 for ovs=1 0 iren 0 rw enable irda module enable irda module and rout usart signals through it. 17.5.22 usartn_route - i/o routing register offset bit position 0x054 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 access rw rw rw rw rw name location clkpen cspen txpen rxpen bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 location 0x0 rw i/o location decides the location of the usart i/o pins. value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 3 loc3 location 3 4 loc4 location 4 5 loc5 location 5 7:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 clkpen 0 rw clk pin enable when set, the clk pin of the usart is enabled. value description 0 the usn_clk pin is disabled 1 the usn_clk pin is enabled 2 cspen 0 rw cs pin enable when set, the cs pin of the usart is enabled. value description 0 the usn_cs pin is disabled 1 the usn_cs pin is enabled
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 489 www.energymicro.com bit name reset access description 1 txpen 0 rw tx pin enable when set, the tx/mosi pin of the usart is enabled value description 0 the u(s)n_tx (mosi) pin is disabled 1 the u(s)n_tx (mosi) pin is enabled 0 rxpen 0 rw rx pin enable when set, the rx/miso pin of the usart is enabled. value description 0 the u(s)n_rx (miso) pin is disabled 1 the u(s)n_rx (miso) pin is enabled 17.5.23 usartn_input - usart input register offset bit position 0x058 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 access rw rw name rxprs rxprssel bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 rxprs 0 rw prs rx enable when set, the prs channel selected as input to rx. 3:0 rxprssel 0x0 rw rx prs channel select select prs channel as input to rx. value mode description 0 prsch0 prs channel 0 selected 1 prsch1 prs channel 1 selected 2 prsch2 prs channel 2 selected 3 prsch3 prs channel 3 selected 4 prsch4 prs channel 4 selected 5 prsch5 prs channel 5 selected 6 prsch6 prs channel 6 selected 7 prsch7 prs channel 7 selected 8 prsch8 prs channel 8 selected 9 prsch9 prs channel 9 selected 10 prsch10 prs channel 10 selected 11 prsch11 prs channel 11 selected
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 490 www.energymicro.com 17.5.24 usartn_i2sctrl - i2s control register offset bit position 0x05c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 0 access rw rw rw rw rw rw name format delay dmasplit justify mono en bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 format 0x0 rw i2s word format configure the data-width used internally for i2s data value mode description 0 w32d32 32-bit word, 32-bit data 1 w32d24m 32-bit word, 32-bit data with 8 lsb masked 2 w32d24 32-bit word, 24-bit data 3 w32d16 32-bit word, 16-bit data 4 w32d8 32-bit word, 8-bit data 5 w16d16 16-bit word, 16-bit data 6 w16d8 16-bit word, 8-bit data 7 w8d8 8-bit word, 8-bit data 7:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 delay 0 rw delay on i2s data set to add a one-cycle delay between a transition on the word-clock and the start of the i2s word. should be set for standard i2s format 3 dmasplit 0 rw separate dma request for left/right data when set dma requests for right-channel data are put on the txblright and rxdatavright dma requests. 2 justify 0 rw justification of i2s data determines whether the i2s data is left or right justified value mode description 0 left data is left-justified 1 right data is right-justified 1 mono 0 rw stero or mono switch between stereo and mono mode. set for mono 0 en 0 rw enable i2s mode set the u(s)art in i2s mode.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 491 www.energymicro.com 18 uart - universal asynchronous receiver/ transmitter 0 1 2 3 4 uart rx tx dma cont roller ram efm32 quick facts what? the uart is capable of high-speed asynchronous serial communication. why? serial communication is frequently used in embedded systems and the uart allows efficient communication with a wide range of external devices. how? the uart has a wide selection of operating modes, frame formats and baud rates. the multi-processor mode allows the uart to remain idle when not addressed. triple buffering and dma support makes high data- rates possible with minimal cpu intervention and it is possible to transmit and receive large frames while the mcu remains in em1. 18.1 introduction the universal asynchronous serial receiver and transmitter (uart) is a very flexible serial i/o module. it supports full- and half-duplex asynchronous uart communication. 18.2 features ? full duplex and half duplex ? separate tx / rx enable ? separate receive / transmit 2-level buffers, with additional separate shift registers ? programmable baud rate, generated as an fractional division from the peripheral clock (hfperclk) ? max bit-rate ? uart standard mode, peripheral clock rate / 16 ? uart fast mode, peripheral clock rate / 8 ? asynchronous mode supports ? majority vote baud-reception ? false start-bit detection ? break generation/detection ? multi-processor mode ? configurable number of data bits, 4-16 (plus the parity bit, if enabled) ? hw parity bit generation and check ? configurable number of stop bits in asynchronous mode: 0.5, 1, 1.5, 2 ? hw collision detection ? multi-processor mode ? separate interrupt vectors for receive and transmit interrupts ? loopback mode ? half duplex communication
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 492 www.energymicro.com ? communication debugging ? prs can trigger transmissions ? full dma support ? prs rx input 18.3 functional description the uart is functionally equivalent to the usart with the exceptions defined in table 18.1 (p. 492 ) . the register map and register descriptions are equal to those of the usart. see the usart chapter for detailed information on the operation of the uart. table 18.1. uart limitations feature limitations synchronous operation not available. sync, csma, smsdelay, sssearly, csinv, cpol and cpha in usartn_ctrl, and masteren in usartn_status are always 0. transmission direction always lsb first. msbf in usartn_ctrl is always 0. chip-select not available. autocs in usartn_ctrl is always 0. smartcard mode not available. scmode in usartn_ctrl is always 0. frame size limited to 8-9 databits. other configurations of databits in usartn_frame are not possible. irda not available. iren in usartn_irctrl is always 0. 18.4 register description the register description of the uart is equivalent to the register description of the usart except the limitations mentioned in table 18.1 (p. 492 ) . see the usart chapter for complete information. 18.5 register map the register map of the uart is equivalent to the register map of the usart. see the usart chapter for complete information.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 493 www.energymicro.com 19 leuart - low energy universal asynchronous receiver/transmitter 0 1 2 3 4 leuart rx tx dma cont roller ram quick facts what? the leuart provides full uart communication using a low frequency 32.768 khz clock, and has special features for communication without cpu intervention. why? it allows uart communication to be performed in low energy modes, using only a few a during active communication and only 150 na when waiting for incoming data. how? a low frequency clock signal allows communication with less energy. using dma, the leuart can transmit and receive data with minimal cpu intervention. special uart-frames can be configured to help control the data flow, further automating data transmission. 19.1 introduction the unique leuart tm , the low energy uart, is a uart that allows two-way uart communication on a strict power budget. only a 32.768 khz clock is needed to allow uart communication up to 9600 baud/s. even when the efm is in low energy mode em2 (with most core functionality turned off), the leuart can wait for an incoming uart frame while having an extremely low energy consumption. when a uart frame is completely received, the cpu can quickly be woken up. alternatively, multiple frames can be transferred via the direct memory access (dma) module into ram memory before waking up the cpu. received data can optionally be blocked until a configurable start frame is detected. a signal frame can be configured to generate an interrupt to indicate e.g. the end of a data transmission. the start frame and signal frame can be used in combination for instance to handle higher level communication protocols. similarly, data can be transmitted in em2 either on a frame-by-frame basis with data from the cpu or through use of the dma. the leuart includes all necessary hardware support to make asynchronous serial communication possible with minimum of software intervention and energy consumption. 19.2 features ? low energy asynchronous serial communications ? full/half duplex communication ? separate tx / rx enable ? separate double buffered transmit buffer and receive buffer ? programmable baud rate, generated as a fractional division of the lfbclk
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 494 www.energymicro.com ? supports baud rates from 300 baud/s to 9600 baud/s ? can use a high frequency clock source for even higher baud rates ? configurable number of data bits: 8 or 9 (plus parity bit, if enabled) ? configurable parity: off, even or odd ? hw parity bit generation and check ? configurable number of stop bits, 1 or 2 ? capable of sleep-mode wake-up on received frame ? either wake-up on any received byte or ? wake up only on specified start and signal frames ? supports transmission and reception in em0, em1 and em2 with ? full dma support ? specified start-byte can start reception automatically ? irda modulator (pulse generator, pulse extender) ? multi-processor mode ? loopback mode ? half duplex communication ? communication debugging ? prs rx input 19.3 functional description an overview of the leuart module is shown in figure 19.1 (p. 494 ) . figure 19.1. leuart overview tx buffer tx shift regist er signal fram e int errupt rx buffer rx shift regist er leun_rx uart cont rol and st at us peripheral bus tx baud rat e generat or rx baud rat e generat or st art fram e ( startframe) rx wakeup sync = pulse ext end pulse gen signal fram e ( sigframe) = st art fram e int errupt ! rxblock leun_tx prs input 19.3.1 frame format the frame format used by the leuart consists of a set of data bits in addition to bits for synchronization and optionally a parity bit for error checking. a frame starts with one start-bit (s), where the line is driven
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 495 www.energymicro.com low for one bit-period. this signals the start of a frame, and is used for synchronization. following the start bit are 8 or 9 data bits and an optional parity bit. the data is transmitted with the least significant bit first. finally, a number of stop-bits, where the line is driven high, end the frame. the frame format is shown in figure 19.2 (p. 495 ) . figure 19.2. leuart asynchronous frame format s 0 1 2 3 4 5 6 7 [ 8] [ p] st op st art or idle st op or idle fram e the number of data bits in a frame is set by databits in leuartn_ctrl, and the number of stop-bits is set by stopbits in leuartn_ctrl. whether or not a parity bit should be included, and whether it should be even or odd is defined by parity in leuartn_ctrl. for communication to be possible, all parties of an asynchronous transfer must agree on the frame format being used. the frame format used by the leuart can be inverted by setting inv in leuartn_ctrl. this affects the entire frame, resulting in a low idle state, a high start-bit, inverted data and parity bits, and low stop- bits. inv should only be changed while the receiver is disabled. 19.3.1.1 parity bit calculation and handling hardware automatically inserts parity bits into outgoing frames and checks the parity bits of incoming frames. the possible parity modes are defined in table 19.1 (p. 495 ) . when even parity is chosen, a parity bit is inserted to make the number of high bits (data + parity) even. if odd parity is chosen, the parity bit makes the total number of high bits odd. when parity bits are disabled, which is the default configuration, the parity bit is omitted. table 19.1. leuart parity bit parity [1:0] description 00 no parity (default) 01 reserved 10 even parity 11 odd parity see section 19.3.5.4 (p. 500 ) for more information on parity bit handling. 19.3.2 clock source the leuart clock source is selected by the lfb bit field the cmu_lfclksel register. the clock is prescaled by the leuartn bitfield in the cmu_lfbpresc0 register and enabled by the leuartn bit in the cmu_lfbclken0. to use this module, the le interface clock must be enabled in cmu_hfcoreclken0, in addition to the module clock. 19.3.3 clock generation the leuart clock defines the transmission and reception data rate. the clock generator employs a fractional clock divider to allow baud rates that are not attainable by integral division of the 32.768 khz clock that drives the leuart.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 496 www.energymicro.com the clock divider used in the leuart is a 12-bit value, with a 7-bit integral part and a 5-bit fractional part. the baud rate of the leuart is given by : leuart baud rate equation br = fleuartn/(1 + leuartn_clkdiv/256) (19.1) where fleuartn is the clock frequency supplied to the leuart. the value of leuartn_clkdiv thus defines the baud rate of the leuart. the integral part of the divider is right-aligned in the upper 24 bits of leuartn_clkdiv and the fractional part is left-aligned in the lower 8 bits. the divider is thus a 256th of leuartn_clkdiv as seen in the equation. for a desired baud rate br desired , leuartn_clkdiv can be calculated by using: leuart clkdiv equation leuartn_clkdiv = 256 x (fleuartn/br desired - 1) (19.2) table 19.2 (p. 496 ) lists a set of desired baud rates and the closest baud rates reachable by the leuart with a 32.768 khz clock source. it also shows the average baud rate error. table 19.2. leuart baud rates desired baud rate [baud/s] leuartn_clkdiv leuartn_clkdiv/256 actual baud rate [baud/s] error [%] 300 27704 108,21875 300,0217 0,01 600 13728 53,625 599,8719 -0,02 1200 6736 26,3125 1199,744 -0,02 2400 3240 12,65625 2399,487 -0,02 4800 1488 5,8125 4809,982 0,21 9600 616 2,40625 9619,963 0,21 19.3.4 data transmission data transmission is initiated by writing data to the transmit buffer using one of the methods described in section 19.3.4.1 (p. 496 ) . when the transmission shift register is empty and ready for new data, a frame from the transmit buffer is loaded into the shift register, and if the transmitter is enabled, transmission begins. when the frame has been transmitted, a new frame is loaded into the shift register if available, and transmission continues. if the transmit buffer is empty, the transmitter goes to an idle state, waiting for a new frame to become available. transmission is enabled through the command register leuartn_cmd by setting txen, and disabled by setting txdis. when the transmitter is disabled using txdis, any ongoing transmission is aborted, and any frame currently being transmitted is discarded. when disabled, the tx output goes to an idle state, which by default is a high value. whether or not the transmitter is enabled at a given time can be read from txens in leuartn_status. after a transmission, when there is no more data in the shift register or transmit buffer, the txc flag in leuartn_status and the txc interrupt flag in leuartn_if are set, signaling that the transmitter is idle. the txc status flag is cleared when a new byte becomes available for transmission, but the txc interrupt flag must be cleared by software. 19.3.4.1 transmit buffer operation a frame can be loaded into the transmit buffer by writing to leuartn_txdata or leuartn_txdatax. using leuartn_txdata allows 8 bits to be written to the buffer. if 9 bit frames are used, the 9th bit will in that case be set to the value of bit8dv in leuartn_ctrl. to set the 9th bit directly and/or use transmission control, leuartn_txdatax must be used. when writing data to the transmit buffer
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 497 www.energymicro.com using leuartn_txdatax, the 9th bit written to leuartn_txdatax overrides the value in bit8dv, and alone defines the 9th bit that is transmitted if 9-bit frames are used. if a write is attempted to the transmit buffer when it is not empty, the txof interrupt flag in leuartn_if is set, indicating the overflow. the data already in the buffer is in that case preserved, and no data is written. in addition to the interrupt flag txc in leuartn_if and the status flag txc in leuartn_status which are set when the transmitter becomes idle, txbl in leuartn_status and the txbl interrupt flag in leuartn_if are used to indicate the level of the transmit buffer. whenever the transmit buffer becomes empty, these flags are set high. both the txbl status flag and the txbl interrupt flag are cleared automatically when data is written to the transmit buffer. the transmit buffer, including the tx shift register can be cleared by setting command bit cleartx in leuartn_cmd. this will prevent the leuart from transmitting the data in the buffer and shift register, and will make them available for new data. any frame currently being transmitted will not be aborted. transmission of this frame will be completed. an overview of the operation of the transmitter is shown in figure 19.3 (p. 497 ) . figure 19.3. leuart transmitter overview leun_tx transm it shift regist er txens d0-d8 cont rol d0 d2 d4 d6 d8 d7 d5 d3 d1 cont rol txdata txdatax bit8dv transm it buffer 0 19.3.4.2 frame transmission control the transmission control bits, which can be written using leuartn_txdatax, affect the transmission of the written frame. the following options are available: ? generate break: by setting wbreak, the output will be held low during the first stop-bit period to generate a framing error. a receiver that supports break detection detects this state, allowing it to be used e.g. for framing of larger data packets. the line is driven high for one baud period before the next frame is transmitted so the next start condition can be identified correctly by the recipient. continuous breaks lasting longer than an uart frame are thus not supported by the leuart. gpio can be used for this. note that when autotri in leuartn_ctrl is used, the transmitter is not tristated before the high-bit after the break has been transmitted. ? disable transmitter after transmission: if txdisat is set, the transmitter is disabled after the frame has been fully transmitted. ? enable receiver after transmission: if rxenat is set, the receiver is enabled after the frame has been fully transmitted. it is enabled in time to detect a start-bit directly after the last stop-bit has been transmitted. the transmission control bits in the leuart cannot tristate the transmitter. this is performed automatically by hardware however, if autotri in leuartn_ctrl is set. see section 19.3.7 (p. 502 ) for more information on half duplex operation.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 498 www.energymicro.com 19.3.4.3 jitter in transmitted data internally the leuart module uses only the positive edges of the 32.768 khz clock (lfbclk) for transmission and reception. transmitted data will thus have jitter equal to the difference between the optimal data set-up location and the closest positive edge on the 32.768 khz clock. the jitter in on the location data is set up by the transmitter will thus be no more than half a clock period according to the optimal set-up location. the jitter in the period of a single baud output by the transmitter will never be more than one clock period. 19.3.5 data reception data reception is enabled by setting rxen in leuartn_cmd. when the receiver is enabled, it actively samples the input looking for a transition from high to low indicating the start baud of a new frame. when a start baud is found, reception of the new frame begins if the receive shift register is empty and ready for new data. when the frame has been received, it is pushed into the receive buffer, making the shift register ready for another frame of data, and the receiver starts looking for another start baud. if the receive buffer is full, the received frame remains in the shift register until more space in the receive buffer is available. if an incoming frame is detected while both the receive buffer and the receive shift register are full, the data in the receive shift register is overwritten, and the rxof interrupt flag in leuartn_if is set to indicate the buffer overflow. the receiver can be disabled by setting the command bit rxdis in leuartn_cmd. any frame currently being received when the receiver is disabled is discarded. whether or not the receiver is enabled at a given time can be read out from rxens in leuartn_status. 19.3.5.1 receive buffer operation when data becomes available in the receive buffer, the rxdatav flag in leuartn_status and the rxdatav interrupt flag in leuartn_if are set. both the rxdatav status flag and the rxdatav interrupt flag are cleared by hardware when data is no longer available, i.e. when data has been read out of the buffer. data can be read from receive buffer using either leuartn_rxdata or leuartn_rxdatax. leuartn_rxdata gives access to the 8 least significant bits of the received frame, while leuartn_rxdatax must be used to get access to the 9th, most significant bit. the latter register also contains status information regarding the frame. when a frame is read from the receive buffer using leuartn_rxdata or leuartn_rxdatax, the frame is removed from the buffer, making room for a new one. if an attempt is done to read more frames from the buffer than what is available, the rxuf interrupt flag in leuartn_if is set to signal the underflow, and the data read from the buffer is undefined. frames can also be read from the receive buffer without removing the data by using leuartn_rxdataxp, which gives access to the frame in the buffer including control bits. data read from this register when the receive buffer is empty is undefined. no underflow interrupt is generated by a read using leuartn_rxdataxp, i.e. the rxuf interrupt flag is never set as a result of reading from leuartn_rxdataxp. an overview of the operation of the receiver is shown in figure 19.4 (p. 499 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 499 www.energymicro.com figure 19.4. leuart receiver overview leun_rx receive shift regist er rxens ! rxblock d0-d8 st at us d0 d2 d4 d6 d8 d7 d5 d3 d1 st at us rxdata rxdatax ( rxdataxp) receive buffer 19.3.5.2 blocking incoming data when using hardware frame recognition, as detailed in section 19.3.5.6 (p. 500 ) , section 19.3.5.7 (p. 501 ) , and section 19.3.5.8 (p. 501 ) , it is necessary to be able to let the receiver sample incoming frames without passing the frames to software by loading them into the receive buffer. this is accomplished by blocking incoming data. incoming data is blocked as long as rxblock in leuartn_status is set. when blocked, frames received by the receiver will not be loaded into the receive buffer, and software is not notified by the rxdatav bit in leuartn_status or the rxdatav interrupt flag in leuartn_if at their arrival. for data to be loaded into the receive buffer, rxblock must be cleared in the instant a frame is fully received by the receiver. rxblock is set by setting rxblocken in leuartn_cmd and disabled by setting rxblockdis also in leuartn_cmd. there are two exceptions where data is loaded into the receive buffer even when rxblock is set. the first is when an address frame is received when in operating in multi-processor mode as shown in section 19.3.5.8 (p. 501 ) . the other case is when receiving a start-frame when sfubrx in leuartn_ctrl is set; see section 19.3.5.6 (p. 500 ) frames received containing framing or parity errors will not result in the ferr and perr interrupt flags in leuartn_if being set while rxblock is set. hardware recognition is not applied to these erroneous frames, and they are silently discarded. note if a frame is received while rxblock in leuartn_status is cleared, but stays in the receive shift register because the receive buffer is full, the received frame will be loaded into the receive buffer when space becomes available even if rxblock is set at that time. the overflow interrupt flag rxof in leuartn_if will be set if a frame in the receive shift register, waiting to be loaded into the receive buffer is overwritten by an incoming frame even though rxblock is set. 19.3.5.3 data sampling the receiver samples each incoming baud as close as possible to the middle of the baud-period. except for the start-bit, only a single sample is taken of each of the incoming bauds. the length of a baud-period is given by 1 + leuartn_clkdiv/256, as a number of 32.768 khz clock periods. let the clock cycle where a start-bit is first detected be given the index 0. the optimal sampling point for each baud in the uart frame is then given by the following equation: leuart optimal sampling point
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 500 www.energymicro.com s opt (n) = n (1 + leuartn_clkdiv/256) + clkdiv/512 (19.3) where n is the bit-index. since samples are only done on the positive edges of the 32.768 khz clock, the actual samples are performed on the closest positive edge, i.e. the edge given by the following equation: leuart actual sampling point s(n) = floor(n x (1 + leuartn_clkdiv/256) + leuartn_clkdiv/512) (19.4) the sampling location will thus have jitter according to difference between s opt and s. the start-bit is found at n=0, then follows the data bits, any parity bit, and the stop bits. if the value of the start-bit is found to be high, then the start-bit is discarded, and the receiver waits for a new start-bit. 19.3.5.4 parity error when the parity bit is enabled, a parity check is automatically performed on incoming frames. when a parity error is detected in a frame, the data parity error bit perr in the frame is set, as well as the interrupt flag perr. frames with parity errors are loaded into the receive buffer like regular frames. perr can be accessed by reading the frame from the receive buffer using the leuartn_rxdatax register. 19.3.5.5 framing error and break detection a framing error is the result of a received frame where the stop bit was sampled to a value of 0. this can be the result of noise and baud rate errors, but can also be the result of a break generated by the transmitter on purpose. when a framing error is detected, the framing error bit ferr in the received frame is set. the interrupt flag ferr in leuartn_if is also set. frames with framing errors are loaded into the receive buffer like regular frames. ferr can be accessed by reading the frame from the receive buffer using the leuartn_rxdatax or leuartn_rxdataxp registers. 19.3.5.6 programmable start frame the leuart can be configured to start receiving data when a special start frame is detected on the input. this can be useful when operating in low energy modes, allowing other devices to gain the attention of the leuart by transmitting a given frame. when sfubrx in leuartn_ctrl is set, an incoming frame matching the frame defined in leuartn_startframe will result in rxblock in leuartn_status being cleared. this can be used to enable reception when a specified start frame is detected. if the receiver is enabled and blocked, i.e. rxens and rxblock in leuartn_status are set, the receiver will receive all incoming frames, but unless an incoming frame is a start frame it will be discarded and not loaded into the receive buffer. when a start frame is detected, the block is cleared, and frames received from that point, including the start frame, are loaded into the receive buffer. an incoming start frame results in the startf interrupt flag in leuartn_if being set, regardless of the value of sfubrx in leuartn_ctrl. this allows an interrupt to be made when the start frame is detected.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 501 www.energymicro.com when 8 data-bit frame formats are used, only the 8 least significant bits of leuartn_startframe are compared to incoming frames. the full length of leuartn_startframe is used when operating with frames consisting of 9 data bits. note the receiver must be enabled for start frames to be detected. in addition, a start frame with a parity error or framing error is not detected as a start frame. 19.3.5.7 programmable signal frame as well as the configurable start frame, a special signal frame can be specified. when a frame matching the frame defined in leuartn_sigframe is detected by the receiver, the sigf interrupt flag in leuartn_if is set. as for start frame detection, the receiver must be enabled for signal frames to be detected. one use of the programmable signal frame is to signal the end of a multi-frame message transmitted to the leuart. an interrupt will then be triggered when the packet has been completely received, allowing software to process it. used in conjunction with the programmable start frame and dma, this makes it possible for the leuart to automatically begin the reception of a packet on a specified start frame, load the entire packet into memory, and give an interrupt when reception of a packet has completed. the device can thus wait for data packets in em2, and only be woken up when a packet has been completely received. a signal frame with a parity error or framing error is not detected as a signal frame. 19.3.5.8 multi-processor mode to simplify communication between multiple processors and maintain compatibility with the usart, the leuart supports a multi-processor mode. in this mode the 9th data bit in each frame is used to indicate whether the content of the remaining 8 bits is data or an address. when multi-processor mode is enabled, an incoming 9-bit frame with the 9th bit equal to the value of mpab in leuartn_ctrl is identified as an address frame. when an address frame is detected, the mpaf interrupt flag in leuartn_if is set, and the address frame is loaded into the receive register. this happens regardless of the value of rxblock in leuartn_status. multi-processor mode is enabled by setting mpm in leuartn_ctrl. the mode can be used in buses with multiple slaves, allowing the slaves to be addressed using the special address frames. an addressed slave, which was previously blocking reception using rxblock, would then unblock reception, receive a message from the bus master, and then block reception again, waiting for the next message. see the usart for a more detailed example. note the programmable start frame functionality can be used for automatic address matching, enabling reception on a correctly configured incoming frame. an address frame with a parity error or a framing error is not detected as an address frame. 19.3.6 loopback the leuart receiver samples leun_rx by default, and the transmitter drives leun_tx by default. this is not the only configuration however. when loopbk in leuartn_ctrl is set, the receiver is connected to the leun_tx pin as shown in figure 19.5 (p. 502 ) . this is useful for debugging, as the leuart can receive the data it transmits, but it is also used to allow the leuart to read and write to the same pin, which is required for some half duplex communication modes. in this mode, the leun_tx pin must be enabled as an output in the gpio.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 502 www.energymicro.com figure 19.5. leuart local loopback leuart rx leun_rx tx leun_tx loopbk = 0 c leuart rx leun_rx tx leun_tx loopbk = 1 c 19.3.7 half duplex communication when doing full duplex communication, two data links are provided, making it possible for data to be sent and received at the same time. in half duplex mode, data is only sent in one direction at a time. there are several possible half duplex setups, as described in the following sections. 19.3.7.1 single data-link in this setup, the leuart both receives and transmits data on the same pin. this is enabled by setting loopbk in leuartn_ctrl, which connects the receiver to the transmitter output. because they are both connected to the same line, it is important that the leuart transmitter does not drive the line when receiving data, as this would corrupt the data on the line. when communicating over a single data-link, the transmitter must thus be tristated whenever not transmitting data. if autotri in leuartn_ctrl is set, the leuart automatically tristates leun_tx whenever the transmitter is inactive. it is then the responsibility of the software protocol to make sure the transmitter is not transmitting data whenever incoming data is expected. the transmitter can also be tristated from software by configuring the gpio pin as an input and disabling the leuart output on leun_tx. note another way to tristate the transmitter is to enable wired-and or wired-or mode in gpio. for wired-and mode, outputting a 1 will be the same as tristating the output, and for wired- or mode, outputting a 0 will be the same as tristating the output. this can only be done on buses with a pull-up or pull-down resistor respectively. 19.3.7.2 single data-link with external driver some communication schemes, such as rs-485 rely on an external driver. here, the driver has an extra input which enables it, and instead of tristating the transmitter when receiving data, the external driver must be disabled. the usart has hardware support for automatically turning the driver on and off. when using the leuart in such a setup, the driver must be controlled by a gpio. figure 19.6 (p. 502 ) shows an example configuration using an external driver. figure 19.6. leuart half duplex communication with external driver leuart rx tx c gpio 19.3.7.3 two data-links some limited devices only support half duplex communication even though two data links are available. in this case software is responsible for making sure data is not transmitted when incoming data is expected.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 503 www.energymicro.com 19.3.8 transmission delay by configuring txdelay in leuartn_ctrl, the transmitter can be forced to wait a number of bit- periods from it is ready to transmit data, to it actually transmits the data. this delay is only applied to the first frame transmitted after the transmitter has been idle. when transmitting frames back-to-back the delay is not introduced between the transmitted frames. this is useful on half duplex buses, because the receiver always returns received frames to software during the first stop-bit. the bus may still be driven for up to 3 baud periods, depending on the current frame format. using the transmission delay, a transmission can be started when a frame is received, and it is possible to make sure that the transmitter does not begin driving the output before the frame on the bus is completely transmitted. 19.3.9 prs rx input the leuart can be configured to receive data directly from the prs channel by setting rx_prs in leuartn_input. the prs channel used can be selected using rx_prs_sel in leuartn_input. 19.3.10 dma support the leuart has full dma support in energy modes em0 ? em2. the dma controller can write to the transmit buffer using the registers leuartn_txdata and leuartn_txdatax, and it can read from receive buffer using the registers leuartn_rxdata and leuartn_rxdatax. this enables single byte transfers and 9 bit data + control/status bits transfers both to and from the leuart. the dma will start up the hfrco and run from this when it is waken by the leuart in em2. the hfrco is disabled once the transaction is done. a request for the dma controller to read from the receive buffer can come from one of the following sources: ? receive buffer full a write request can come from one of the following sources: ? transmit buffer and shift register empty. no data to send. ? transmit buffer empty in some cases, it may be sensible to temporarily stop dma access to the leuart when a parity or framing error has occurred. this is enabled by setting errsdma in leuartn_ctrl. when this bit is set, the dma controller will not get requests from the receive buffer if a framing error or parity error is detected in the received byte. the errsdma bit applies only to the rx dma. when operating in em2, the dma controller must be powered up in order to perform the transfer. this is automatically performed for read operations if rxdmawu in leuartn_ctrl is set and for write operations if txdmawu in leuartn_ctrl is set. to make sure the dma controller still transfers bits to and from the leuart in low energy modes, these bits must thus be configured accordingly. note when rxdmawu or txdmawu is set, the system will not be able to go to em2/em3 before all related leuart dma requests have been processed. this means that if rxdmawu is set and the leuart receives a frame, the system will not be able to go to em2/em3 before the frame has been read from the leuart. in order for the system to go to em2 during the last byte transmission, leuart_ctrl_txdmawu must be cleared in the dma interrupt service routine. this is because txbl will be high during that last byte transfer.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 504 www.energymicro.com 19.3.11 pulse generator/ pulse extender the leuart has an optional pulse generator for the transmitter output, and a pulse extender on the receiver input. these are enabled by setting pulseen in leuartn_pulsectrl, and with inv in leuartn_ctrl set, they will change the output/input format of the leuart from nrz to rzi as shown in figure 19.7 (p. 504 ) . figure 19.7. leuart - nrz vs. rzi s 0 1 2 3 4 5 6 7 p st op idle idle nrz rzi if pulseen in leuartn_pulsectrl is set while inv in leuartn_ctrl is cleared, the output waveform will like rzi shown in figure 19.7 (p. 504 ) , only inverted. the width of the pulses from the pulse generator can be configured using pulsew in leuartn_pulsectrl. the generated pulse width is pulsew + 1 cycles of the 32.768 khz clock, which makes pulse width from 31.25s to 500s possible. since the incoming signal is only sampled on positive clock edges, the width of the incoming pulses must be at least two 32.768 khz clock periods wide for reliable detection by the leuart receiver. they must also be shorter than half a uart baud period. at 2400 baud/s or lower, the pulse generator is able to generate rzi pulses compatible with the irda physical layer specification. the external irda device must generate pulses of sufficient length for successful two-way communication. 19.3.11.1 interrupts the interrupts generated by the leuart are combined into one interrupt vector. if leuart interrupts are enabled, an interrupt will be made if one or more of the interrupt flags in leuartn_if and their corresponding bits in leuart_ien are set. 19.3.12 register access since this module is a low energy peripheral, and runs off a clock which is asynchronous to the hfcoreclk, special considerations must be taken when accessing registers. please refer to section 5.3 (p. 21 ) for a description on how to perform register accesses to low energy peripherals.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 505 www.energymicro.com 19.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 leuartn_ctrl rw control register 0x004 leuartn_cmd w1 command register 0x008 leuartn_status r status register 0x00c leuartn_clkdiv rw clock control register 0x010 leuartn_startframe rw start frame register 0x014 leuartn_sigframe rw signal frame register 0x018 leuartn_rxdatax r receive buffer data extended register 0x01c leuartn_rxdata r receive buffer data register 0x020 leuartn_rxdataxp r receive buffer data extended peek register 0x024 leuartn_txdatax w transmit buffer data extended register 0x028 leuartn_txdata w transmit buffer data register 0x02c leuartn_if r interrupt flag register 0x030 leuartn_ifs w1 interrupt flag set register 0x034 leuartn_ifc w1 interrupt flag clear register 0x038 leuartn_ien rw interrupt enable register 0x03c leuartn_pulsectrl rw pulse control register 0x040 leuartn_freeze rw freeze register 0x044 leuartn_syncbusy r synchronization busy register 0x054 leuartn_route rw i/o routing register 0x0ac leuartn_input rw leuart input register 19.5 register description 19.5.1 leuartn_ctrl - control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 0 0 0 0 0 0 0x0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw name txdelay txdmawu rxdmawu bit8dv mpab mpm sfubrx loopbk errsdma inv stopbits parity databits autotri bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:14 txdelay 0x0 rw tx delay transmission configurable delay before new transfers. frames sent back-to-back are not delayed. value mode description 0 none frames are transmitted immediately 1 single transmission of new frames are delayed by a single baud period 2 double transmission of new frames are delayed by two baud periods
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 506 www.energymicro.com bit name reset access description value mode description 3 triple transmission of new frames are delayed by three baud periods 13 txdmawu 0 rw tx dma wakeup set to wake the dma controller up when in em2 and space is available in the transmit buffer. value description 0 while in em2, the dma controller will not get requests about space being available in the transmit buffer 1 dma is available in em2 for the request about space available in the transmit buffer 12 rxdmawu 0 rw rx dma wakeup set to wake the dma controller up when in em2 and data is available in the receive buffer. value description 0 while in em2, the dma controller will not get requests about data being available in the receive buffer 1 dma is available in em2 for the request about data in the receive buffer 11 bit8dv 0 rw bit 8 default value when 9-bit frames are transmitted, the default value of the 9th bit is given by bit8dv. if txdata is used to write a frame, then the value of bit8dv is assigned to the 9th bit of the outgoing frame. if a frame is written with txdatax however, the default value is overridden by the written value. 10 mpab 0 rw multi-processor address-bit defines the value of the multi-processor address bit. an incoming frame with its 9th bit equal to the value of this bit marks the frame as a multi-processor address frame. 9 mpm 0 rw multi-processor mode set to enable multi-processor mode. value description 0 the 9th bit of incoming frames have no special function 1 an incoming frame with the 9th bit equal to mpab will be loaded into the receive buffer regardless of rxblock and will result in the mpab interrupt flag being set 8 sfubrx 0 rw start-frame unblock rx clears rxblock when the start-frame is found in the incoming data. the start-frame is loaded into the receive buffer. value description 0 detected start-frames have no effect on rxblock 1 when a start-frame is detected, rxblock is cleared and the start-frame is loaded into the receive buffer 7 loopbk 0 rw loopback enable set to connect receiver to leun_tx instead of leun_rx. value description 0 the receiver is connected to and receives data from leun_rx 1 the receiver is connected to and receives data from leun_tx 6 errsdma 0 rw clear rx dma on error when set,rx dma requests will be cleared on framing and parity errors. value description 0 framing and parity errors have no effect on dma requests from the leuart 1 rx dma requests from the leuart are disabled if a framing error or parity error occurs. 5 inv 0 rw invert input and output set to invert the output on leun_tx and input on leun_rx. value description 0 a high value on the input/output is 1, and a low value is 0. 1 a low value on the input/output is 0, and a high value is 0. 4 stopbits 0 rw stop-bit mode determines the number of stop-bits used. only used when transmitting data. the receiver only verifies that one stop bit is present.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 507 www.energymicro.com bit name reset access description value mode description 0 one one stop-bit is transmitted with every frame 1 two two stop-bits are transmitted with every frame 3:2 parity 0x0 rw parity-bit mode determines whether parity bits are enabled, and whether even or odd parity should be used. value mode description 0 none parity bits are not used 2 even even parity are used. parity bits are automatically generated and checked by hardware. 3 odd odd parity is used. parity bits are automatically generated and checked by hardware. 1 databits 0 rw data-bit mode this register sets the number of data bits. value mode description 0 eight each frame contains 8 data bits 1 nine each frame contains 9 data bits 0 autotri 0 rw automatic transmitter tristate when set, leun_tx is tristated whenever the transmitter is inactive. value description 0 leun_tx is held high when the transmitter is inactive. inv inverts the inactive state. 1 leun_tx is tristated when the transmitter is inactive 19.5.2 leuartn_cmd - command register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 name clearrx cleartx rxblockdis rxblocken txdis txen rxdis rxen bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 clearrx 0 w1 clear rx set to clear receive buffer and the rx shift register. 6 cleartx 0 w1 clear tx set to clear transmit buffer and the tx shift register. 5 rxblockdis 0 w1 receiver block disable set to clear rxblock, resulting in all incoming frames being loaded into the receive buffer. 4 rxblocken 0 w1 receiver block enable set to set rxblock, resulting in all incoming frames being discarded. 3 txdis 0 w1 transmitter disable set to disable transmission. 2 txen 0 w1 transmitter enable set to enable data transmission.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 508 www.energymicro.com bit name reset access description 1 rxdis 0 w1 receiver disable set to disable data reception. if a frame is under reception when the receiver is disabled, the incoming frame is discarded. 0 rxen 0 w1 receiver enable set to activate data reception on leun_rx. 19.5.3 leuartn_status - status register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 1 0 0 0 0 access r r r r r r name rxdatav txbl txc rxblock txens rxens bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 rxdatav 0 r rx data valid set when data is available in the receive buffer. cleared when the receive buffer is empty. 4 txbl 1 r tx buffer level indicates the level of the transmit buffer. set when the transmit buffer is empty, and cleared when it is full. 3 txc 0 r tx complete set when a transmission has completed and no more data is available in the transmit buffer. cleared when a new transmission starts. 2 rxblock 0 r block incoming data when set, the receiver discards incoming frames. an incoming frame will not be loaded into the receive buffer if this bit is set at the instant the frame has been completely received. 1 txens 0 r transmitter enable status set when the transmitter is enabled. 0 rxens 0 r receiver enable status set when the receiver is enabled. the receiver must be enabled for start frames, signal frames, and multi-processor address bit detection. 19.5.4 leuartn_clkdiv - clock control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 access rw name div
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 509 www.energymicro.com bit name reset access description 31:15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14:3 div 0x000 rw fractional clock divider specifies the fractional clock divider for the leuart. 2:0 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19.5.5 leuartn_startframe - start frame register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 access rw name startframe bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 startframe 0x000 rw start frame when a frame matching startframe is detected by the receiver, startf interrupt flag is set, and if sfubrx is set, rxblock is cleared. the start-frame is be loaded into the rx buffer. 19.5.6 leuartn_sigframe - signal frame register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 access rw name sigframe bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 sigframe 0x000 rw signal frame when a frame matching sigframe is detected by the receiver, sigf interrupt flag is set.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 510 www.energymicro.com 19.5.7 leuartn_rxdatax - receive buffer data extended register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x000 access r r r name ferr perr rxdata bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 ferr 0 r receive data framing error set if data in buffer has a framing error. can be the result of a break condition. 14 perr 0 r receive data parity error set if data in buffer has a parity error. 13:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 rxdata 0x000 r rx data use this register to access data read from the leuart. buffer is cleared on read access. 19.5.8 leuartn_rxdata - receive buffer data register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access r name rxdata bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 rxdata 0x00 r rx data use this register to access data read from leuart. buffer is cleared on read access. only the 8 lsb can be read using this register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 511 www.energymicro.com 19.5.9 leuartn_rxdataxp - receive buffer data extended peek register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x000 access r r r name ferrp perrp rxdatap bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 ferrp 0 r receive data framing error peek set if data in buffer has a framing error. can be the result of a break condition. 14 perrp 0 r receive data parity error peek set if data in buffer has a parity error. 13:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 rxdatap 0x000 r rx data peek use this register to access data read from the leuart. 19.5.10 leuartn_txdatax - transmit buffer data extended register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0x000 access w w w w name rxenat txdisat txbreak txdata bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15 rxenat 0 w enable rx after transmission set to enable reception after transmission. value description 0 - 1 the receiver is enabled, setting rxens after the frame has been transmitted 14 txdisat 0 w disable tx after transmission set to disable transmitter directly after transmission has competed. value description 0 -
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 512 www.energymicro.com bit name reset access description value description 1 the transmitter is disabled, clearing txens after the frame has been transmitted 13 txbreak 0 w transmit data as break set to send data as a break. recipient will see a framing error or a break condition depending on its configuration and the value of txdata. value description 0 the specified number of stop-bits are transmitted 1 instead of the ordinary stop-bits, 0 is transmitted to generate a break. a single stop-bit is generated after the break to allow the receiver to detect the start of the next frame 12:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:0 txdata 0x000 w tx data use this register to write data to the leuart. if the transmitter is enabled, a transfer will be initiated at the first opportunity. 19.5.11 leuartn_txdata - transmit buffer data register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access w name txdata bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 txdata 0x00 w tx data this frame will be added to the transmit buffer. only 8 lsb can be written using this register. 9th bit and control bits will be cleared. 19.5.12 leuartn_if - interrupt flag register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 1 0 access r r r r r r r r r r r name sigf startf mpaf ferr perr txof rxuf rxof rxdatav txbl txc bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 sigf 0 r signal frame interrupt flag set when a signal frame is detected. 9 startf 0 r start frame interrupt flag set when a start frame is detected. 8 mpaf 0 r multi-processor address frame interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 513 www.energymicro.com bit name reset access description set when a multi-processor address frame is detected. 7 ferr 0 r framing error interrupt flag set when a frame with a framing error is received while rxblock is cleared. 6 perr 0 r parity error interrupt flag set when a frame with a parity error is received while rxblock is cleared. 5 txof 0 r tx overflow interrupt flag set when a write is done to the transmit buffer while it is full. the data already in the transmit buffer is preserved. 4 rxuf 0 r rx underflow interrupt flag set when trying to read from the receive buffer when it is empty. 3 rxof 0 r rx overflow interrupt flag set when data is incoming while the receive shift register is full. the data previously in shift register is overwritten by the new data. 2 rxdatav 0 r rx data valid interrupt flag set when data becomes available in the receive buffer. 1 txbl 1 r tx buffer level interrupt flag set when space becomes available in the transmit buffer for a new frame. 0 txc 0 r tx complete interrupt flag set after a transmission when both the tx buffer and shift register are empty. 19.5.13 leuartn_ifs - interrupt flag set register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 name sigf startf mpaf ferr perr txof rxuf rxof txc bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 sigf 0 w1 set signal frame interrupt flag write to 1 to set the sigf interrupt flag. 9 startf 0 w1 set start frame interrupt flag write to 1 to set the startf interrupt flag. 8 mpaf 0 w1 set multi-processor address frame interrupt flag write to 1 to set the mpaf interrupt flag. 7 ferr 0 w1 set framing error interrupt flag write to 1 to set the ferr interrupt flag. 6 perr 0 w1 set parity error interrupt flag write to 1 to set the perr interrupt flag. 5 txof 0 w1 set tx overflow interrupt flag write to 1 to set the txof interrupt flag. 4 rxuf 0 w1 set rx underflow interrupt flag write to 1 to set the rxuf interrupt flag. 3 rxof 0 w1 set rx overflow interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 514 www.energymicro.com bit name reset access description write to 1 to set the rxof interrupt flag. 2:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 txc 0 w1 set tx complete interrupt flag write to 1 to set the txc interrupt flag. 19.5.14 leuartn_ifc - interrupt flag clear register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 name sigf startf mpaf ferr perr txof rxuf rxof txc bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 sigf 0 w1 clear signal-frame interrupt flag write to 1 to clear the sigf interrupt flag. 9 startf 0 w1 clear start-frame interrupt flag write to 1 to clear the startf interrupt flag. 8 mpaf 0 w1 clear multi-processor address frame interrupt flag write to 1 to clear the mpaf interrupt flag. 7 ferr 0 w1 clear framing error interrupt flag write to 1 to clear the ferr interrupt flag. 6 perr 0 w1 clear parity error interrupt flag write to 1 to clear the perr interrupt flag. 5 txof 0 w1 clear tx overflow interrupt flag write to 1 to clear the txof interrupt flag. 4 rxuf 0 w1 clear rx underflow interrupt flag write to 1 to clear the rxuf interrupt flag. 3 rxof 0 w1 clear rx overflow interrupt flag write to 1 to clear the rxof interrupt flag. 2:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 txc 0 w1 clear tx complete interrupt flag write to 1 to clear the txc interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 515 www.energymicro.com 19.5.15 leuartn_ien - interrupt enable register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw name sigf startf mpaf ferr perr txof rxuf rxof rxdatav txbl txc bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 sigf 0 rw signal frame interrupt enable enable interrupt on signal frame. 9 startf 0 rw start frame interrupt enable enable interrupt on start frame. 8 mpaf 0 rw multi-processor address frame interrupt enable enable interrupt on multi-processor address frame. 7 ferr 0 rw framing error interrupt enable enable interrupt on framing error. 6 perr 0 rw parity error interrupt enable enable interrupt on parity error. 5 txof 0 rw tx overflow interrupt enable enable interrupt on tx overflow. 4 rxuf 0 rw rx underflow interrupt enable enable interrupt on rx underflow. 3 rxof 0 rw rx overflow interrupt enable enable interrupt on rx overflow. 2 rxdatav 0 rw rx data valid interrupt enable enable interrupt on rx data. 1 txbl 0 rw tx buffer level interrupt enable enable interrupt on tx buffer level. 0 txc 0 rw tx complete interrupt enable enable interrupt on tx complete. 19.5.16 leuartn_pulsectrl - pulse control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x0 access rw rw rw name pulsefilt pulseen pulsew
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 516 www.energymicro.com bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 pulsefilt 0 rw pulse filter enable a one-cycle pulse filter for pulse extender value description 0 filter is disabled. pulses must be at least 2 cycles long for reliable detection. 1 filter is enabled. pulses must be at least 3 cycles long for reliable detection. 4 pulseen 0 rw pulse generator/extender enable filter leuart output through pulse generator and the leuart input through the pulse extender. 3:0 pulsew 0x0 rw pulse width configure the pulse width of the pulse generator as a number of 32.768 khz clock cycles. 19.5.17 leuartn_freeze - freeze register offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name regfreeze bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 regfreeze 0 rw register update freeze when set, the update of the leuart is postponed until this bit is cleared. use this bit to update several registers simultaneously. value mode description 0 update each write access to a leuart register is updated into the low frequency domain as soon as possible. 1 freeze the leuart is not updated with the new written value. 19.5.18 leuartn_syncbusy - synchronization busy register offset bit position 0x044 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access r r r r r r r r name pulsectrl txdata txdatax sigframe startframe clkdiv cmd ctrl bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7 pulsectrl 0 r pulsectrl register busy set when the value written to pulsectrl is being synchronized. 6 txdata 0 r txdata register busy
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 517 www.energymicro.com bit name reset access description set when the value written to txdata is being synchronized. 5 txdatax 0 r txdatax register busy set when the value written to txdatax is being synchronized. 4 sigframe 0 r sigframe register busy set when the value written to sigframe is being synchronized. 3 startframe 0 r startframe register busy set when the value written to startframe is being synchronized. 2 clkdiv 0 r clkdiv register busy set when the value written to clkdiv is being synchronized. 1 cmd 0 r cmd register busy set when the value written to cmd is being synchronized. 0 ctrl 0 r ctrl register busy set when the value written to ctrl is being synchronized. 19.5.19 leuartn_route - i/o routing register offset bit position 0x054 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 access rw rw rw name location txpen rxpen bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 location 0x0 rw i/o location decides the location of the leuart i/o pins. value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 3 loc3 location 3 4 loc4 location 4 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 txpen 0 rw tx pin enable when set, the tx pin of the leuart is enabled. value description 0 the leun_tx pin is disabled 1 the leun_tx pin is enabled 0 rxpen 0 rw rx pin enable when set, the rx pin of the leuart is enabled. value description 0 the leun_rx pin is disabled 1 the leun_rx pin is enabled
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 518 www.energymicro.com 19.5.20 leuartn_input - leuart input register offset bit position 0x0ac 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 access rw rw name rxprs rxprssel bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 rxprs 0 rw prs rx enable when set, the prs channel selected as input to rx. 3:0 rxprssel 0x0 rw rx prs channel select select prs channel as input to rx. value mode description 0 prsch0 prs channel 0 selected 1 prsch1 prs channel 1 selected 2 prsch2 prs channel 2 selected 3 prsch3 prs channel 3 selected 4 prsch4 prs channel 4 selected 5 prsch5 prs channel 5 selected 6 prsch6 prs channel 6 selected 7 prsch7 prs channel 7 selected 8 prsch8 prs channel 8 selected 9 prsch9 prs channel 9 selected 10 prsch10 prs channel 10 selected 11 prsch11 prs channel 11 selected
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 519 www.energymicro.com 20 timer - timer/counter 0 1 2 3 4 timer count er capt ure values com pare values = prs adc out put com pare/pwm input capt ure usart clock quick facts what? the timer (timer/counter) keeps track of timing and counts events, generates output waveforms and triggers timed actions in other peripherals. why? most applications have activities that need to be timed accurately with as little cpu intervention and energy consumption as possible. how? the flexible 16-bit timer can be configured to provide pwm waveforms with optional dead-time insertion for e.g. motor control, or work as a frequency generator. the timer can also count events and control other peripherals through the prs, which offloads the cpu and reduce energy consumption. 20.1 introduction the 16-bit general purpose timer has 3 compare/capture channels for input capture and compare/pulse- width modulation (pwm) output. timer0 also includes a dead-time insertion module suitable for motor control applications. 20.2 features ? 16-bit auto reload up/down counter ? dedicated 16-bit reload register which serves as counter maximum ? 3 compare/capture channels ? individual configurable as either input capture or output compare/pwm ? multiple counter modes ? count up ? count down ? count up/down ? quadrature decoder ? direction and count from external pins ? 2x count mode ? counter control from prs or external pin ? start ? stop ? reload and start ? inter-timer connection ? allows 32-bit counter mode ? start/stop synchronization between several timers ? input capture
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 520 www.energymicro.com ? period measurement ? pulse width measurement ? two capture registers for each capture channel ? capture on either positive or negative edge ? capture on both edges ? optional digital noise filtering on capture inputs ? output compare ? compare output toggle/pulse on compare match ? immediate update of compare registers ? pwm ? up-count pwm ? up/down-count pwm ? predictable initial pwm output state (configured by sw) ? buffered compare register to ensure glitch-free update of compare values ? clock sources ? hfperclk timern ? 10-bit prescaler ? external pin ? peripheral reflex system ? debug mode ? configurable to either run or stop when processor is stopped (break) ? interrupts, prs output and/or dma request ? underflow ? overflow ? compare/capture event ? dead-time insertion unit (timer0 only) ? complementary pwm outputs with programmable dead-time ? dead-time is specified independently for rising and falling edge ? 10-bit prescaler ? 6-bit time value ? outputs have configurable polarity ? outputs can be set inactive individually by software. ? configurable action on fault ? set outputs inactive ? clear output ? tristate output ? individual fault sources ? one or two prs signals ? debugger ? support for automatic restart ? core lockup ? configuration lock 20.3 functional description an overview of the timer module is shown in figure 20.1 (p. 521 ) . the timer module consists of a 16 bit up/down counter with 3 compare/capture channels connected to pins timn_cc0, timn_cc1, and timn_cc2.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 521 www.energymicro.com figure 20.1. timer block overview = = com pare and pwm config com pare and pwm config com pare and pwm config = tnccr0[ 15:0 ] tnccr1[ 15:0 ] com pare mat ch x timern_top timern_cnt timern_ccx input capt ure updat e condit ion not e: for sim plicit y, all timern _ccx regist ers are grouped t oget her in t he figure , but t hey all have individual input capt ure regist ers = = 0 cntclk count er cont rol overflow underflow timn_cc0 input logic edge det ect quadrat ure decoder input logic input logic edge det ect edge det ect prs input s prs input s prs input s prescaler hfperclk timern timn_cc1 timn_cc2 timn_cc0 timn_cc1 timn_cc2 20.3.1 counter modes the timer consists of a counter that can be configured to the following modes: 1. up-count: counter counts up until it reaches the value in timern_top, where it is reset to 0 before counting up again. 2. down-count: the counter starts at the value in timern_top and counts down. when it reaches 0, it is reloaded with the value in timern_top. 3. up/down-count: the counter starts at 0 and counts up. when it reaches the value in timern_top, it counts down until it reaches 0 and starts counting up again. 4. quadrature decoder: two input channels where one determines the count direction, while the other pin triggers a clock event. in addition, to the timer modes listed above, the timer also supports a 2x count mode. in this mode the counter increments/decrements by 2. the 2x count mode intended use is to generate 2x pwm frequency when the compare/capture channel is put in pwm mode. the 2x count mode can be enabled by setting the x2cnt bitfield in the timern_ctrl register. the counter value can be read or written by software at any time by accessing the cnt field in timern_cnt. 20.3.1.1 events overflow is set when the counter value shifts from timern_top to the next value when counting up. in up-count mode the next value is 0. in up/down-count mode, the next value is timern_top-1. underflow is set when the counter value shifts from 0 to the next value when counting down. in down- count mode, the next value is timern_top. in up/down-count mode the next value is 1. update event is set on overflow in up-count mode and on underflow in down-count or up/down count mode. this event is used to time updates of buffered values. 20.3.1.2 operation figure 20.2 (p. 522 ) shows the hardware timer/counter control. software can start or stop the counter by writing a 1 to the start or stop bits in timern_cmd. the counter value (cnt in timern_cnt) can always be written by software to any 16-bit value.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 522 www.energymicro.com it is also possible to control the counter through either an external pin or prs input. this is done through the input logic for the compare/capture channel 0. the timer/counter allows individual actions (start, stop, reload) to be taken for rising and falling input edges. this is configured in the risea and falla fields in timern_ctrl. the reload value is 0 in up-count and up/down-count mode and top in down- count mode. the running bit in timern_status indicates if the timer is running or not. if the sync bit in timern_ctrl is set, the timer is started/stopped/reloaded (external pin or prs) when any of the other timers are started/stopped/reloaded. the dir bit in timern_status indicates the counting direction of the timer at any given time. the counter value can be read or written by software through the cnt field in timern_cnt. in up/down- count mode the count direction will be set to up if the cnt value is written by software. figure 20.2. timer hardware timer/counter control cou n t e r ( cont rolled by timern _ ctrl ) com p a r e /ca p t u r e ch a n n e l 0 ( cont rolled by timern _ cc 0 _ ctrl ) timn_cc0 prs channels prssel insel filt er filt icedge input capt ure 0 cou n t e r risea falla st art st op reload& st art 20.3.1.3 clock source the counter can be clocked from several sources, which are all synchronized with the peripheral clock (hfperclk). see figure 20.3 (p. 522 ) . figure 20.3. timer clock selection cou n t e r ( cont rolled by timern _ ctrl ) com p a r e /ca p t u r e ch a n n e l 1 ( cont rolled by timern _ cc 1 _ ctrl ) timn_cc1 prs channels prssel insel filt er filt icedge hfperclk timern clksel prescaler presc input capt ure 1 count er 20.3.1.3.1 peripheral clock (hfperclk) the peripheral clock (hfperclk) can be used as a source with a configurable prescale factor of 2^presc, where presc is an integer between 0 and 10, which is set in presc in timern_ctrl. however, if 2x count mode is enabled and the compare/capture channels are put in pwm mode, the cc output is updated on both clock edges so prescaling the peripheral clock will result in incorrect result. the prescaler is stopped and reset when the timer is stopped.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 523 www.energymicro.com 20.3.1.3.2 compare/ capture channel 1 input the timer can also be clocked by positive and/or negative edges on the compare/capture channel 1 input. this input can either come from the timn_cc1 pin or one of the prs channels. the input signal must not have a higher frequency than f hfperclk /3 when running from a pin input or a prs input with filt enabled in timern_ccx_ctrl. when running from prs without filt, the frequency can be as high as f hfperclk . note that when clocking the timer from the same pulse that triggers a start (through risea/falla in timern_ctrl), the starting pulse will not update the counter value. 20.3.1.3.3 underflow/overflow from neighboring timer all timers are linked together (see figure 20.4 (p. 523 ) ), allowing timers to count on overflow/underflow from the lower numbered neighbouring timers to form a 32-bit or 48-bit timer. note that all timers must be set to same count direction and less significant timer(s) can only be set to count up or down. figure 20.4. timer connections timer0 timer1 timer2 overflow overflow underflow underflow 20.3.1.4 one-shot mode by default, the counter counts continuously until it is stopped. if the osmen bit is set in the timern_ctrl register, however, the counter is disabled by hardware on the first update event . note that when the counter is running with cc1 as clock source (0b01 in clksel in timern_ctrl) and osmen is set, a cc1 capture event will not take place on the update event (cc1 rising edge) that stops the timer. 20.3.1.5 top value buffer the timern_top register can be altered either by writing it directly or by writing to the timer_topb (buffer) register. when writing to the buffer register the timern_topb register will be written to timern_top on the next update event. buffering ensures that the top value is not set below the actual count value. the topbv flag in timern_status indicates whether the timern_topb register contains data that have not yet been written to the timern_top register (see figure 20.5 (p. 523 ) . figure 20.5. timer top value update functionality top apb writ e (topb) topb load apb load apb topbv set clear apb writ e (top) updat e event load topb apb dat a 20.3.1.6 quadrature decoder quadrature decoding mode is used to track motion and determine both rotation direction and position. the quadrature decoder uses two input channels that are 90 degrees out of phase (see figure 20.6 (p. 524 ) ).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 524 www.energymicro.com figure 20.6. timer quadrature encoded inputs channel a channel b forward rot at ion (channel a leads channel b) 90 channel a channel b backward rot at ion (channel b leads channel a) 90 in the timer these inputs are tapped from the compare/capture channel 0 (channel a) and 1 (channel b) inputs before edge detection. the timer/counter then increments or decrements the counter, based on the phase relation between the two inputs. the quadrature decoder mode supports two channels, but if a third channel (z-terminal) is available, this can be connected to an external interrupt and trigger a counter reset from the interrupt service routine. by connecting a periodic signal from another timer as input capture on compare/capture channel 2, it is also possible to calculate speed and acceleration. figure 20.7. timer quadrature decoder configuration cou n t e r ( cont rolled by timern _ ctrl ) com p a r e /ca p t u r e ch a n n e l 1 ( cont rolled by timern _ cc 1 _ ctrl ) com p a r e /ca p t u r e ch a n n e l 0 ( cont rolled by timern _ cc 0 _ ctrl ) timn_cc0 prs channels prssel insel filt er filt icedge qu a d r a t u r e d e cod e r timn_cc1 prs channels prssel insel filt er filt icedge input capt ure 0 input capt ure 1 cou n t e r inc dec qdm mode ch b ch a the quadrature decoder can be set in either x2 or x4 mode, which is configured in the qdm bit in timern_ctrl. see figure 20.7 (p. 524 ) 20.3.1.6.1 x2 decoding mode in x2 decoding mode, the counter increments or decrements on every edge of channel a, see table 20.1 (p. 525 ) and figure 20.8 (p. 525 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 525 www.energymicro.com table 20.1. timer counter response in x2 decoding mode channel a channel b rising falling 0 increment decrement 1 decrement increment figure 20.8. timer x2 decoding mode channel a channel b cnt 3 4 5 6 7 8 3 4 5 6 7 2 8 20.3.1.6.2 x4 decoding mode in x4 decoding mode, the counter increments or decrements on every edge of channel a and channel b, see figure 20.9 (p. 525 ) and table 20.2 (p. 525 ) . table 20.2. timer counter response in x4 decoding mode channel a channel b opposite channel rising falling rising falling channel a = 0 decrement increment channel a = 1 increment decrement channel b = 0 increment decrement channel b = 1 decrement increment figure 20.9. timer x4 decoding mode channel a channel b 3 4 5 6 7 8 9 10 11 3 4 5 6 7 8 9 10 11 2 2 cnt 20.3.1.6.3 timer rotational position to calculate a position equation 20.1 (p. 525 ) can be used. timer rotational position equation pos = (cnt/x x n) x 360 (20.1) where x = encoding type and n = number of pulses per revolution. 20.3.2 compare/capture channels the timer contains 3 compare/capture channels, which can be configured in the following modes: 1. input capture 2. output compare
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 526 www.energymicro.com 3. pwm 20.3.2.1 input pin logic each compare/capture channel can be configured as an input source for the capture unit or as external clock source for the timer (see figure 20.10 (p. 526 ) ). compare/capture channels 0 and 1 are the inputs for the quadrature decoder mode. the input channel can be filtered before it is used, which requires the input to remain stable for 5 cycles in a row before the input is propagated to the output. figure 20.10. timer input pin logic timn_ccx prs channels prssel insel filt er filt icedge input capt ure x 20.3.2.2 compare/capture registers the compare/capture channel registers are prefixed with timern_ccx_, where the x stands for the channel number. since the compare/capture channels serve three functions (input capture, compare, pwm), the behavior of the compare/capture registers (timern_ccx_ccv) and buffer registers (timern_ccx_ccvb) change depending on the mode the channel is set in. 20.3.2.2.1 input capture mode when running in input capture mode, timern_ccx_ccv and timern_ccx_ccvb form a fifo buffer, and new capture values are added on a capture event, see figure 20.11 (p. 526 ) . the first capture can always be read from timern_ccx_ccv, and reading this address will load the next capture value into timern_ccx_ccv from timern_ccx_ccvb if it contains valid data. the cc value can be read without altering the fifo contents by reading timern_ccx_ccvp. timern_ccx_ccvb can also be read without altering the fifo contents. the icv flag in timern_status indicates if there is a valid unread capture in timern_ccx_ccv. in case a capture is triggered while both ccv and ccvb contain unread capture values, the buffer overflow interrupt flag (icbof in timern_if) will be set. new capture values will on overflow overwrite the value in timern_ccx_ccvb. note in input capture mode, the timer will only trigger interrupts when it is running figure 20.11. timer input capture buffer functionality fifo cn t ccv ccv b apb dat a 20.3.2.2.2 compare and pwm mode when running in output compare or pwm mode, the value in timern_ccx_ccv will be compared against the count value. in compare mode the output can be configured to toggle, clear or set
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 527 www.energymicro.com on compare match, overflow and underflow through the cmoa, cofoa and cufoa fields in timern_ccx_ctrl. timern_ccx_ccv can be accessed directly or through the buffer register timern_ccx_ccvb, see figure 20.12 (p. 527 ) . when writing to the buffer register, the value in timern_ccx_ccvb will be written to timern_ccx_ccv on the next update event. this functionality ensures glitch free pwm outputs. the ccvbv flag in timern_status indicates whether the timern_ccx_ccvb register contains data that have not yet been written to the timern_ccx_ccv register. note that when writing 0 to timern_ccx_ccvb the ccv value is updated when the timer counts from 0 to 1. thus, the compare match for the next period will not happen until the timer reaches 0 again on the way down. figure 20.12. timer output compare/pwm buffer functionality ccv apb writ e (ccb) ccv b load apb load apb ccv bv set clear apb writ e (cc) updat e event load ccb apb dat a 20.3.2.3 input capture in input capture mode, the counter value (timern_cnt) can be captured in the compare/capture register (timern_ccx_ccv), see figure 20.13 (p. 527 ) . in this mode, timern_ccx_ccv is read-only. together with the compare/capture buffer register (timern_ccx_ccvb) the timern_ccx_ccv form a double-buffered capture registers allowing two subsequent capture events to take place before a read-out is required. the ccpol bits in timern_status indicate the polarity the edge that triggered the capture in timern_ccx_ccv. figure 20.13. timer input capture timern_ccx_ccv m m n y z timern_cnt input read timern_ccx_ccvb timern_ccx_ccvb m y prev. val prev. val 20.3.2.3.1 period/pulse-width capture period and/or pulse-width capture can be achieved by setting the risea field in timern_ctrl to clear&start, and select the wanted input from either external pin or prs, see figure 20.14 (p. 528 ) . for period capture, the compare/capture channel should then be set to input capture on a rising edge of the same input signal. to capture a the width of a high pulse, the compare/capture channel should be set to capture on a falling edge of the input signal. to start the measuring period on either a falling edge or measure the low pulse-width of a signal, opposite polarities should be chosen.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 528 www.energymicro.com figure 20.14. timer period and/or pulse width capture 0 input cnt clear& st art input capt ure (frequency capt ure) input capt ure (pulse-widt h capt ure) 20.3.2.4 compare each compare/capture channel contains a comparator which outputs a compare match if the contents of timern_ccx_ccv matches the counter value, see figure 20.15 (p. 528 ) . in compare mode, each compare channel can be configured to either set, clear or toggle the output on an event (compare match, overflow or underflow). the output from each channel is represented as an alternative function on the port it is connected to, which needs to be enabled for the cc outputs to propagate to the pins. figure 20.15. timer block diagram showing comparison functionality tnccr0[ 15:0 ] tnccr1[ 15:0 ] underflow com pare mat ch x timern_top timern_cnt timern_ccx updat e condit ion not e: for sim plicit y, all timern _ccx regist ers are grouped t oget her in t he figure , but t hey all have individual com pare regist er and logic = = 0 = = timn_cc0 com pare and pwm config com pare and pwm config com pare and pwm config = timn_cc1 timn_cc2 cntclk overflow if occurring in the same cycle, match action will have priority over overflow or underflow action. the input selected (through prssel, insel and filtsel in timern_ccx_ctrl) for the cc channel will also be sampled on compare match and the result is found in the ccpol bits in timern_status. it is also possible to configure the ccpol to always track the inputs by setting ati in timern_ctrl. the coist bit in timern_ccx_ctrl is the initial state of the compare/pwm output. the coist bit can also be used as an initial value to the compare outputs on a reload-start when rsscoist is set in timern_ctrl. also the resulting output can be inverted by setting outinv in timern_ccx_ctrl. it is recommended to turn off the cc channel before configuring the output state to avoid any pulses on the output. the cc channel can be turned off by setting mode to off in timer_ccx_ctrl.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 529 www.energymicro.com figure 20.16. timer output logic timn_ccx coist outinv out put com pare / pwm x 0 1 20.3.2.4.1 frequency generation (frg) frequency generation (see figure 20.17 (p. 529 ) ) can be achieved in compare mode by: ? setting the counter in up-count mode ? enabling buffering of the top value. ? setting the cc channels overflow action to toggle figure 20.17. timer up-count frequency generation 0 timern_top timern_ccx_ccv the output frequency is given by equation 20.2 (p. 529 ) timer up-count frequency generation equation f frg = f hfperclk / ( 2^(presc + 1) x (top + 1) x 2) (20.2) 20.3.2.5 pulse-width modulation (pwm) in pwm mode, timern_ccx_ccv is buffered to avoid glitches in the output. the settings in the compare output action configuration bits are ignored in pwm mode and pwm generation is only supported for up-count and up/down-count mode. 20.3.2.6 up-count (single-slope) pwm if the counter is set to up-count and the compare/capture channel is put in pwm mode, single slope pwm output will be generated (see figure 20.18 (p. 529 ) ). in up-count mode the pwm period is top +1 cycles and the pwm output will be high for a number of cycles equal to timern_ccx_ccv. this means that a constant high output is achieved by setting timer_ccx to top+1 or higher. the pwm resolution (in bits) is then given by equation 20.3 (p. 529 ) . figure 20.18. timer up-count pwm generation 0 timern_top timern_ccx_ccv timn_ccx overflow com pare m at ch buffer updat e timer up-count pwm resolution equation
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 530 www.energymicro.com r pwm up = log(top+1)/log(2) (20.3) the pwm frequency is given by equation 20.4 (p. 530 ) : timer up-count pwm frequency equation f pwm up/down = f hfperclk / ( 2^presc x (top + 1) (20.4) the high duty cycle is given by equation 20.5 (p. 530 ) timer up-count duty cycle equation ds up = ccvx/top (20.5) 20.3.2.6.1 2x count mode when the timer is set in 2x mode, the timer will count up by two. this will in effect make any odd top value be rounded down to the closest even number. similarly, any odd cc value will generate a match on the closest lower even value as shown in figure 20.19 (p. 530 ) figure 20.19. timer cc out in 2x mode 2 4 0 2 4 0 clock cc out 0 2 4 0 2 4 0 0 top = 5 cc = 1 top = 5 cc = 2 the mode is enabled by setting the x2cnt field in timern_ctrl register. the intended use of the 2x mode is to generate 2x pwm frequency when the compare/capture channel is put in pwm mode. since the pwm output is updated on both edges of the clock, frequency prescaling will result in incorrect result in this mode. the pwm resolution (in bits) is then given by equation 20.6 (p. 530 ) . timer 2x pwm resolution equation r pwm 2xmode = log(top/2+1)/log(2) (20.6) the pwm frequency is given by equation 20.7 (p. 530 ) : timer 2x mode pwm frequency equation( up-count) f pwm 2xmode = 2 x f hfperclk / floor(top/2)+1 (20.7) the high duty cycle is given by equation 20.8 (p. 530 ) timer 2x mode duty cycle equation ds 2xmode = ccvx/top (20.8)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 531 www.energymicro.com 20.3.2.7 up/down-count (dual-slope) pwm if the counter is set to up-down count and the compare/capture channel is put in pwm mode, dual slope pwm output will be generated by figure 20.20 (p. 531 ) .the resolution (in bits) is given by equation 20.9 (p. 531 ) . figure 20.20. timer up/down-count pwm generation 0 timern_top timern_ccx_ccv timn_ccx overflow com pare m at ch buffer updat e timer up/down-count pwm resolution equation r pwm up/down = log(top+1)/log(2) (20.9) the pwm frequency is given by equation 20.10 (p. 531 ) : timer up/down-count pwm frequency equation f pwm up/down = f hfperclk / ( 2^(presc+1) x top) (20.10) the high duty cycle is given by equation 20.11 (p. 531 ) timer up/down-count duty cycle equation ds up/down = ccvx/top (20.11) 20.3.2.7.1 2x count mode when the timer is set in 2x mode, the timer will count up/down by two. this will in effect make any odd top value be rounded down to the closest even number. similarly, any odd cc value will generate a match on the closest lower even value as shown in figure 20.21 (p. 531 ) figure 20.21. timer cc out in 2x mode 2 4 2 0 2 0 clock cc out 4 2 4 2 0 2 0 4 top = 5 cc = 1 top = 5 cc = 2 the mode is enabled by setting the x2cnt field in timern_ctrl register. the intended use of the 2x mode is to generate 2x pwm frequency when the compare/capture channel is put in pwm mode. since the pwm output is updated on both edges of the clock, frequency prescaling will result in incorrect result in this mode. the pwm resolution (in bits) is then given by equation 20.12 (p. 532 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 532 www.energymicro.com timer 2x pwm resolution equation r pwm 2xmode = log(top/2+1)/log(2) (20.12) the pwm frequency is given by equation 20.7 (p. 530 ) : timer 2x mode pwm frequency equation( up/down-count) f pwm 2xmode = f hfperclk / top (20.13) the high duty cycle is given by equation 20.14 (p. 532 ) timer 2x mode duty cycle equation ds 2xmode = ccvx/top (20.14) 20.3.3 dead-time insertion unit (timer0 only) the dead-time insertion unit aims to make control of bldc motors safer and more efficient by introducing complementary pwm outputs with dead-time insertion and fault handling, see figure 20.22 (p. 532 ) . figure 20.22. timer dead-time insertion unit overview dead t im e insert ion original pwm (tim0_ccx_pre) fault handling prim ary out put (tim0_ccx) com plem ent ary out put (tim0_cdtix) fault sources when used for motor control, the pwm outputs tim0_cc0, tim0_cc1 and tim0_cc2 are often connected to the high-side transistors of a triple half-bridge setup (uh, vh and wh), and the complementary outputs connected to the respective low-side transistors (ul, vl, wl shown in figure 20.23 (p. 532 ) ). transistors used in such a bridge often do not open/close instantaneously, and using the exact complementary inputs for the high and low side of a half-bridge may result in situations where both gates are open. this can give unnecessary current-draw and short circuit the power supply. the dti unit provides dead-time insertion to deal with this problem. figure 20.23. timer triple half-bridge uh vh wh wl vl ul w v u for each of the 3 compare-match outputs of timer0, an additional complementary output is provided by the dti unit. these outputs, named tim0_cdti0, tim0_cdti1 and tim0_cdti2 are provided to make
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 533 www.energymicro.com control of e.g. 3-channel bldc or pmac motors possible using only a single timer, see figure 20.24 (p. 533 ) . figure 20.24. timer overview of dead-time insertion block for a single pwm channel clock cont rol count er select dtf all t dtr ise t = 0 original pwm (tim0_ccx_pre) hfperclk timern prim ary out put (tim0_ccx) com plem ent ary out put (tim0_cdtix) the dti unit is enabled by setting dten in timer0_dtctrl. in addition to providing the complementary outputs, the dti unit then also overrides the compare match outputs from the timer. the dti unit gives the rising edges of the pwm outputs and the rising edges of the complementary pwm outputs a configurable time delay. by doing this, the dti unit introduces a dead-time where both the primary and complementary outputs in a pair are inactive as seen in figure 20.25 (p. 533 ) . figure 20.25. timer polarity of both signals are set as active-high original pwm tim 0 _cc0 tim 0 _cdti0 dt 1 dt 2 dead-time is specified individually for the rising and falling edge of the original pwm. these values are shared across all the three pwm channels of the dti unit. a single prescaler value is provided for the dti unit, meaning that both the rising and falling edge dead-times share prescaler value. the prescaler divides the hfperclk timern by a configurable factor between 1 and 1024, which is set in the dtpresc field in timer0_dttime. the rising and falling edge dead-times are configured in dtriset and dtfallt in timer0_dttime to any number between 1-64 hfperclk timer0 cycles. 20.3.3.1 output polarity the value of the primary and complementary outputs in a pair will never be set active at the same time by the dti unit. the polarity of the outputs can be changed however, if this is required by the application. the active values of the primary and complementary outputs are set by two the timer0_dtctrl register. the dtipol bit of this register specifies the base polarity. if dtipol =0, then the outputs are active-high, and if dtipol = 1 they are active-low. the relative phase of the primary and complementary outputs is not changed by dtipol, as the polarity of both outputs is changed, see figure 20.26 (p. 534 ) in some applications, it may be required that the primary outputs are active-high, while the complementary outputs are active-low. this can be accomplished by manipulating the dtcinv bit of the timer0_dtctrl register, which inverts the polarity of the complementary outputs relative to the primary outputs. example 20.1. timer dti example 1 dtipol = 0 and dtcinv = 0 results in outputs with opposite phase and active-high states.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 534 www.energymicro.com example 20.2. timer dti example 2 dtipol = 1 and dtcinv = 1 results in outputs with equal phase. the primary output will be active-high, while the complementary will be active-low figure 20.26. timer output polarities original pwm tim 0 _cc0 tim 0 _cdti0 tim 0 _cc0 tim 0 _cdti0 tim 0 _cc0 tim 0 _cdti0 tim 0 _cc0 tim 0 _cdti0 dtipol = 0 dtcinv = 0 dtipol = 1 dtcinv = 0 dtipol = 0 dtcinv = 1 dtipol = 1 dtcinv = 1 output generation on the individual dti outputs can be disabled by configuring timer0_dtogen. when output generation on an output is disabled, it will go to and stay in its inactive state. 20.3.3.2 prs channel as source a prs channel can optionally be used as input to the dti module instead of the pwm output from the timer. setting dtprsen in timer0_dtctrl will override the source of the first dti channel, driving tim0_cc0 and tim0_cdti0, with the value on the prs channel. the rest of the dti channels will continue to be driven by the pwm output from the timer. the prs channel to use is chosen by configuring dtprssel in timer0_dtctrl. note that the timer must be running even when prs is used as dti source. the dti prescaler, set by dtpresc in timer0_dttime determines with which accuracy the dti can insert dead-time into a prs signal. the maximum dead-time error equals 2 dtpresc clock cycles. with zero prescaling, the inserted dead-times are therefore accurate, but they may be inaccurate for larger prescaler settings. 20.3.3.3 fault handling the fault handling system of the dti unit allows the outputs of the dti unit to be put in a well-defined state in case of a fault. this hardware fault handling system makes a fast reaction to faults possible, reducing the possibility of damage to the system. the fault sources which trigger a fault in the dti module are determined by timer0_dtfsen. any combination of the available error sources can be selected: ? prs source 0, determined by dtprs0fsel in timer0_dtfc
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 535 www.energymicro.com ? prs source 1, determined by dtprs1fsel in timer0_dtfc ? debugger ? core lockup one or two prs channels can be used as an error source. when prs source 0 is selected as an error source, dtprs0fsel determines which prs channel is used for this source. dtprs1fsel determines which prs channel is selected as prs source 1. please note that for core lockup, the lockuprdis in rmu_ctrl must be set. otherwise this will generate a full reset of the efm32. 20.3.3.3.1 action on fault when a fault occurs, the bit representing the fault source is set in dtfs, and the outputs from the dti unit are set to a well-defined state. the following options are available, and can be enabled by configuring dtfact in timer0_dtfc: ? set outputs to inactive level ? clear outputs ? tristate outputs with the first option enabled, the output state in case of a fault depends on the polarity settings for the individual outputs. an output set to be active high will be set low if a fault is detected, while an output set to be active low will be driven high. when a fault occurs, the fault source(s) can be read out of timer0_dtfs. timer0_dtfs is organized in the same way as dtfsen, with one bit for each source. 20.3.3.3.2 exiting fault state when a fault is triggered by the prs system, software intervention is required to re-enable the outputs of the dti unit. this is done by manually clearing timer0_dtfs. if the fault cause, determined by timer0_dtfs, is the debugger alone, the outputs can optionally be re-enabled when the debugger exits and the processor resumes normal operation. the corresponding bit in timer0_dtfs will in that case be cleared by hardware. the automatic start-up functionality can be enabled by setting dtdas in timer0_dtctrl. if more bits are still set in dtfs when the automatic start-up functionality has cleared the debugger bit, the dti module does not exit the fault state. the fault state is only exited when all the bits in timer0_dtfs have been cleared. 20.3.3.4 configuration lock to prevent software errors from making changes to the dti configuration, a configuration lock is available. writing any value but 0xce80 to lockkey in timer0_dtlock results in timer0_dtfc, timer0_dtctrl, timer0_dttime and timer0_route being locked for writing. to unlock the registers, write 0xce80 to lockkey in timer0_dtlock. the value of timer0_dtlock is 1 when the lock is active, and 0 when the registers are unlocked. 20.3.4 debug mode when the cpu is halted in debug mode, the timer can be configured to either continue to run or to be frozen. this is configured in dbghalt in timern_ctrl. 20.3.5 interrupts, dma and prs output the timer has 5 output events: ? counter underflow ? counter overflow ? compare match or input capture (one per compare/capture channel)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 536 www.energymicro.com each of the events has its own interrupt flag. also, there is one interrupt flag for each compare/capture channel which is set on buffer overflow in capture mode. buffer overflow happens when a new capture pushes an old unread capture out of the timern_ccx_ccv/timern_ccx_ccvb register pair. if the interrupt flags are set and the corresponding interrupt enable bits in timern_ien) are set high, the timer will send out an interrupt request. each of the events will also lead to a one hfperclk timern cycle high pulse on individual prs outputs. each of the events will also set a dma request when they occur. the different dma requests are cleared when certain acknowledge conditions are met, see table 20.3 (p. 536 ) . if dmaclract is set in timern_ctrl, the dma request is cleared when the triggered dma channel is active, without having to access any timer registers. table 20.3. timer events event acknowledge underflow/overflow read or write to timern_cnt or timern_topb cc 0 read or write to timern_cc0_ccv or timern_cc0_ccvb cc 1 read or write to timern_cc1_ccv or timern_cc1_ccvb cc 2 read or write to timern_cc2_ccv or timern_cc2_ccvb 20.3.6 gpio input/output the timn_ccx inputs/outputs and tim0_cdtix outputs are accessible as alternate functions through gpio. each pin connection can be enabled/disabled separately by setting the corresponding ccxpen or cdtixpen bits in timern_route. the location bits in the same register can be used to move all enabled pins to alternate pins.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 537 www.energymicro.com 20.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 timern_ctrl rw control register 0x004 timern_cmd w1 command register 0x008 timern_status r status register 0x00c timern_ien rw interrupt enable register 0x010 timern_if r interrupt flag register 0x014 timern_ifs w1 interrupt flag set register 0x018 timern_ifc w1 interrupt flag clear register 0x01c timern_top rwh counter top value register 0x020 timern_topb rw counter top value buffer register 0x024 timern_cnt rwh counter value register 0x028 timern_route rw i/o routing register 0x030 timern_cc0_ctrl rw cc channel control register 0x034 timern_cc0_ccv rwh cc channel value register 0x038 timern_cc0_ccvp r cc channel value peek register 0x03c timern_cc0_ccvb rwh cc channel buffer register 0x040 timern_cc1_ctrl rw cc channel control register 0x044 timern_cc1_ccv rwh cc channel value register 0x048 timern_cc1_ccvp r cc channel value peek register 0x04c timern_cc1_ccvb rwh cc channel buffer register 0x050 timern_cc2_ctrl rw cc channel control register 0x054 timern_cc2_ccv rwh cc channel value register 0x058 timern_cc2_ccvp r cc channel value peek register 0x05c timern_cc2_ccvb rwh cc channel buffer register 0x070 timern_dtctrl rw dti control register 0x074 timern_dttime rw dti time control register 0x078 timern_dtfc rw dti fault configuration register 0x07c timern_dtogen rw dti output generation enable register 0x080 timern_dtfault r dti fault register 0x084 timern_dtfaultc w1 dti fault clear register 0x088 timern_dtlock rw dti configuration lock register
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 538 www.energymicro.com 20.5 register description 20.5.1 timern_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0x0 0x0 0 0x0 0x0 0 0 0 0 0 0x0 access rw rw rw rw rw rw rw rw rw rw rw rw rw name rsscoist ati presc clksel x2cnt falla risea dmaclract debugrun qdm osmen sync mode bit name reset access description 31:30 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 29 rsscoist 0 rw reload-start sets compare ouptut initial state when enabled, compare output is set to coist value at reload-start event 28 ati 0 rw always track inputs enable ati makes ccpol always track the polarity of the inputs 27:24 presc 0x0 rw prescaler setting these bits select the prescaling factor. value mode description 0 div1 the hfperclk is undivided 1 div2 the hfperclk is divided by 2 2 div4 the hfperclk is divided by 4 3 div8 the hfperclk is divided by 8 4 div16 the hfperclk is divided by 16 5 div32 the hfperclk is divided by 32 6 div64 the hfperclk is divided by 64 7 div128 the hfperclk is divided by 128 8 div256 the hfperclk is divided by 256 9 div512 the hfperclk is divided by 512 10 div1024 the hfperclk is divided by 1024 23:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 clksel 0x0 rw clock source select these bits select the clock source for the timer. value mode description 0 preschfperclk prescaled hfperclk 1 cc1 compare/capture channel 1 input 2 timerouf timer is clocked by underflow(down-count) or overflow(up-count) in the lower numbered neighbor timer 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13 x2cnt 0 rw 2x count mode enable 2x count mode 12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:10 falla 0x0 rw timer falling input edge action these bits select the action taken in the counter when a falling edge occurs on the input. value mode description 0 none no action 1 start start counter without reload
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 539 www.energymicro.com bit name reset access description value mode description 2 stop stop counter without reload 3 reloadstart reload and start counter 9:8 risea 0x0 rw timer rising input edge action these bits select the action taken in the counter when a rising edge occurs on the input. value mode description 0 none no action 1 start start counter without reload 2 stop stop counter without reload 3 reloadstart reload and start counter 7 dmaclract 0 rw dma request clear on active when this bit is set, the dma requests are cleared when the corresponding dma channel is active. this enables the timer dma requests to be cleared without accessing the timer. 6 debugrun 0 rw debug mode run enable set this bit to enable timer to run in debug mode. value description 0 timer is frozen in debug mode 1 timer is running in debug mode 5 qdm 0 rw quadrature decoder mode selection this bit sets the mode for the quadrature decoder. value mode description 0 x2 x2 mode selected 1 x4 x4 mode selected 4 osmen 0 rw one-shot mode enable enable/disable one shot mode. 3 sync 0 rw timer start/stop/reload synchronization when this bit is set, the timer is started/stopped/reloaded by start/stop/reload commands in the other timers value description 0 timer is not started/stopped/reloaded by other timers 1 timer is started/stopped/reloaded by other timers 2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 mode 0x0 rw timer mode these bit set the counting mode for the timer. note, when quadrature decoder mode is selected (mode = 'b11), the clksel is don't care. the timer is clocked by the decoder mode clock output. value mode description 0 up up-count mode 1 down down-count mode 2 updown up/down-count mode 3 qdec quadrature decoder mode
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 540 www.energymicro.com 20.5.2 timern_cmd - command register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name stop start bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 stop 0 w1 stop timer write a 1 to this bit to stop timer 0 start 0 w1 start timer write a 1 to this bit to start timer 20.5.3 timern_status - status register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 access r r r r r r r r r r r r name ccpol2 ccpol1 ccpol0 icv2 icv1 icv0 ccvbv2 ccvbv1 ccvbv0 topbv dir running bit name reset access description 31:27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26 ccpol2 0 r cc2 polarity in input capture mode, this bit indicates the polarity of the edge that triggered capture in timern_cc2_ccv. in compare/pwm mode, this bit indicates the polarity of the selected input to cc channel 2. these bits are cleared when ccmode is written to 0b00 (off). value mode description 0 lowrise cc2 polarity low level/rising edge 1 highfall cc2 polarity high level/falling edge 25 ccpol1 0 r cc1 polarity in input capture mode, this bit indicates the polarity of the edge that triggered capture in timern_cc1_ccv. in compare/pwm mode, this bit indicates the polarity of the selected input to cc channel 1. these bits are cleared when ccmode is written to 0b00 (off). value mode description 0 lowrise cc1 polarity low level/rising edge 1 highfall cc1 polarity high level/falling edge 24 ccpol0 0 r cc0 polarity in input capture mode, this bit indicates the polarity of the edge that triggered capture in timern_cc0_ccv. in compare/pwm mode, this bit indicates the polarity of the selected input to cc channel 0. these bits are cleared when ccmode is written to 0b00 (off). value mode description 0 lowrise cc0 polarity low level/rising edge 1 highfall cc0 polarity high level/falling edge
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 541 www.energymicro.com bit name reset access description 23:19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18 icv2 0 r cc2 input capture valid this bit indicates that timern_cc2_ccv contains a valid capture value. these bits are only used in input capture mode and are cleared when ccmode is written to 0b00 (off). value description 0 timern_cc2_ccv does not contain a valid capture value(fifo empty) 1 timern_cc2_ccv contains a valid capture value(fifo not empty) 17 icv1 0 r cc1 input capture valid this bit indicates that timern_cc1_ccv contains a valid capture value. these bits are only used in input capture mode and are cleared when ccmode is written to 0b00 (off). value description 0 timern_cc1_ccv does not contain a valid capture value(fifo empty) 1 timern_cc1_ccv contains a valid capture value(fifo not empty) 16 icv0 0 r cc0 input capture valid this bit indicates that timern_cc0_ccv contains a valid capture value. these bits are only used in input capture mode and are cleared when ccmode is written to 0b00 (off). value description 0 timern_cc0_ccv does not contain a valid capture value(fifo empty) 1 timern_cc0_ccv contains a valid capture value(fifo not empty) 15:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 ccvbv2 0 r cc2 ccvb valid this field indicates that the timern_cc2_ccvb registers contain data which have not been written to timern_cc2_ccv. these bits are only used in output compare/pwm mode and are cleared when ccmode is written to 0b00 (off). value description 0 timern_cc2_ccvb does not contain valid data 1 timern_cc2_ccvb contains valid data which will be written to timern_cc2_ccv on the next update event 9 ccvbv1 0 r cc1 ccvb valid this field indicates that the timern_cc1_ccvb registers contain data which have not been written to timern_cc1_ccv. these bits are only used in output compare/pwm mode and are cleared when ccmode is written to 0b00 (off). value description 0 timern_cc1_ccvb does not contain valid data 1 timern_cc1_ccvb contains valid data which will be written to timern_cc1_ccv on the next update event 8 ccvbv0 0 r cc0 ccvb valid this field indicates that the timern_cc0_ccvb registers contain data which have not been written to timern_cc0_ccv. these bits are only used in output compare/pwm mode and are cleared when ccmode is written to 0b00 (off). value description 0 timern_cc0_ccvb does not contain valid data 1 timern_cc0_ccvb contains valid data which will be written to timern_cc0_ccv on the next update event 7:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 topbv 0 r topb valid this indicates that timern_topb contains valid data that has not been written to timern_top. this bit is also cleared when timern_top is written. value description 0 timern_topb does not contain valid data 1 timern_topb contains valid data which will be written to timern_top on the next update event 1 dir 0 r direction indicates count direction. value mode description 0 up counting up
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 542 www.energymicro.com bit name reset access description value mode description 1 down counting down 0 running 0 r running indicates if timer is running or not. 20.5.4 timern_ien - interrupt enable register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw name icbof2 icbof1 icbof0 cc2 cc1 cc0 uf of bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 icbof2 0 rw cc channel 2 input capture buffer overflow interrupt enable enable/disable compare/capture ch 2 input capture buffer overflow interrupt. 9 icbof1 0 rw cc channel 1 input capture buffer overflow interrupt enable enable/disable compare/capture ch 1 input capture buffer overflow interrupt. 8 icbof0 0 rw cc channel 0 input capture buffer overflow interrupt enable enable/disable compare/capture ch 0 input capture buffer overflow interrupt. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 cc2 0 rw cc channel 2 interrupt enable enable/disable compare/capture ch 2 interrupt. 5 cc1 0 rw cc channel 1 interrupt enable enable/disable compare/capture ch 1 interrupt. 4 cc0 0 rw cc channel 0 interrupt enable enable/disable compare/capture ch 0 interrupt. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 uf 0 rw underflow interrupt enable enable/disable underflow interrupt. 0 of 0 rw overflow interrupt enable enable/disable overflow interrupt. 20.5.5 timern_if - interrupt flag register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access r r r r r r r r name icbof2 icbof1 icbof0 cc2 cc1 cc0 uf of
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 543 www.energymicro.com bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 icbof2 0 r cc channel 2 input capture buffer overflow interrupt flag this bit indicates that a new capture value has pushed an unread value out of the timern_cc2_ccv/timern_cc2_ccvb register pair. 9 icbof1 0 r cc channel 1 input capture buffer overflow interrupt flag this bit indicates that a new capture value has pushed an unread value out of the timern_cc1_ccv/timern_cc1_ccvb register pair. 8 icbof0 0 r cc channel 0 input capture buffer overflow interrupt flag this bit indicates that a new capture value has pushed an unread value out of the timern_cc0_ccv/timern_cc0_ccvb register pair. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 cc2 0 r cc channel 2 interrupt flag this bit indicates that there has been an interrupt event on compare/capture channel 2. 5 cc1 0 r cc channel 1 interrupt flag this bit indicates that there has been an interrupt event on compare/capture channel 1. 4 cc0 0 r cc channel 0 interrupt flag this bit indicates that there has been an interrupt event on compare/capture channel 0. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 uf 0 r underflow interrupt flag this bit indicates that there has been an underflow. 0 of 0 r overflow interrupt flag this bit indicates that there has been an overflow. 20.5.6 timern_ifs - interrupt flag set register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 name icbof2 icbof1 icbof0 cc2 cc1 cc0 uf of bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 icbof2 0 w1 cc channel 2 input capture buffer overflow interrupt flag set writing a 1 to this bit will set compare/capture channel 2 input capture buffer overflow interrupt flag. 9 icbof1 0 w1 cc channel 1 input capture buffer overflow interrupt flag set writing a 1 to this bit will set compare/capture channel 1 input capture buffer overflow interrupt flag. 8 icbof0 0 w1 cc channel 0 input capture buffer overflow interrupt flag set writing a 1 to this bit will set compare/capture channel 0 input capture buffer overflow interrupt flag. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 cc2 0 w1 cc channel 2 interrupt flag set writing a 1 to this bit will set compare/capture channel 2 interrupt flag. 5 cc1 0 w1 cc channel 1 interrupt flag set
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 544 www.energymicro.com bit name reset access description writing a 1 to this bit will set compare/capture channel 1 interrupt flag. 4 cc0 0 w1 cc channel 0 interrupt flag set writing a 1 to this bit will set compare/capture channel 0 interrupt flag. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 uf 0 w1 underflow interrupt flag set writing a 1 to this bit will set the underflow interrupt flag. 0 of 0 w1 overflow interrupt flag set writing a 1 to this bit will set the overflow interrupt flag. 20.5.7 timern_ifc - interrupt flag clear register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 name icbof2 icbof1 icbof0 cc2 cc1 cc0 uf of bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 icbof2 0 w1 cc channel 2 input capture buffer overflow interrupt flag clear writing a 1 to this bit will clear compare/capture channel 2 input capture buffer overflow interrupt flag. 9 icbof1 0 w1 cc channel 1 input capture buffer overflow interrupt flag clear writing a 1 to this bit will clear compare/capture channel 1 input capture buffer overflow interrupt flag. 8 icbof0 0 w1 cc channel 0 input capture buffer overflow interrupt flag clear writing a 1 to this bit will clear compare/capture channel 0 input capture buffer overflow interrupt flag. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 cc2 0 w1 cc channel 2 interrupt flag clear writing a 1 to this bit will clear compare/capture interrupt flag 2. 5 cc1 0 w1 cc channel 1 interrupt flag clear writing a 1 to this bit will clear compare/capture interrupt flag 1. 4 cc0 0 w1 cc channel 0 interrupt flag clear writing a 1 to this bit will clear compare/capture interrupt flag 0. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 uf 0 w1 underflow interrupt flag clear writing a 1 to this bit will clear the underflow interrupt flag. 0 of 0 w1 overflow interrupt flag clear writing a 1 to this bit will clear th overflow interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 545 www.energymicro.com 20.5.8 timern_top - counter top value register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xffff access rwh name top bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 top 0xffff rwh counter top value these bits hold the top value for the counter. 20.5.9 timern_topb - counter top value buffer register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name topb bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 topb 0x0000 rw counter top value buffer these bits hold the top buffer value. 20.5.10 timern_cnt - counter value register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rwh name cnt
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 546 www.energymicro.com bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 cnt 0x0000 rwh counter value these bits hold the counter value. 20.5.11 timern_route - i/o routing register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 0 0 access rw rw rw rw rw rw rw name location cdti2pen cdti1pen cdti0pen cc2pen cc1pen cc0pen bit name reset access description 31:19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:16 location 0x0 rw i/o location decides the location of the cc and cdti pins. value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 3 loc3 location 3 4 loc4 location 4 5 loc5 location 5 15:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 cdti2pen 0 rw cc channel 2 complementary dead-time insertion pin enable enable/disable cc channel 2 complementary dead-time insertion output connection to pin. 9 cdti1pen 0 rw cc channel 1 complementary dead-time insertion pin enable enable/disable cc channel 1 complementary dead-time insertion output connection to pin. 8 cdti0pen 0 rw cc channel 0 complementary dead-time insertion pin enable enable/disable cc channel 0 complementary dead-time insertion output connection to pin. 7:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 cc2pen 0 rw cc channel 2 pin enable enable/disable cc channel 2 output/input connection to pin. 1 cc1pen 0 rw cc channel 1 pin enable enable/disable cc channel 1 output/input connection to pin. 0 cc0pen 0 rw cc channel 0 pin enable enable/disable cc channel 0 output/input connection to pin.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 547 www.energymicro.com 20.5.12 timern_ccx_ctrl - cc channel control register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0 0 0x0 0x0 0x0 0x0 0 0 0x0 access rw rw rw rw rw rw rw rw rw rw rw name icevctrl icedge filt insel prssel cufoa cofoa cmoa coist outinv mode bit name reset access description 31:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27:26 icevctrl 0x0 rw input capture event control these bits control when a compare/capture prs output pulse, interrupt flag and dma request is set. value mode description 0 everyedge prs output pulse, interrupt flag and dma request set on every capture 1 everysecondedge prs output pulse, interrupt flag and dma request set on every second capture 2 rising prs output pulse, interrupt flag and dma request set on rising edge only (if icedge = both) 3 falling prs output pulse, interrupt flag and dma request set on falling edge only (if icedge = both) 25:24 icedge 0x0 rw input capture edge select these bits control which edges the edge detector triggers on. the output is used for input capture and external clock input. value mode description 0 rising rising edges detected 1 falling falling edges detected 2 both both edges detected 3 none no edge detection, signal is left as it is 23:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21 filt 0 rw digital filter enable digital filter. value mode description 0 disable digital filter disabled 1 enable digital filter enabled 20 insel 0 rw input selection select compare/capture channel input. value mode description 0 pin timernccx pin is selected 1 prs prs input (selected by prssel) is selected 19:16 prssel 0x0 rw compare/capture channel prs input channel selection select prs input channel for compare/capture channel. value mode description 0 prsch0 prs channel 0 selected as input 1 prsch1 prs channel 1 selected as input 2 prsch2 prs channel 2 selected as input 3 prsch3 prs channel 3 selected as input 4 prsch4 prs channel 4 selected as input 5 prsch5 prs channel 5 selected as input 6 prsch6 prs channel 6 selected as input 7 prsch7 prs channel 7 selected as input
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 548 www.energymicro.com bit name reset access description value mode description 8 prsch8 prs channel 8 selected as input 9 prsch9 prs channel 9 selected as input 10 prsch10 prs channel 10 selected as input 11 prsch11 prs channel 11 selected as input 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:12 cufoa 0x0 rw counter underflow output action select output action on counter underflow. value mode description 0 none no action on counter underflow 1 toggle toggle output on counter underflow 2 clear clear output on counter underflow 3 set set output on counter underflow 11:10 cofoa 0x0 rw counter overflow output action select output action on counter overflow. value mode description 0 none no action on counter overflow 1 toggle toggle output on counter overflow 2 clear clear output on counter overflow 3 set set output on counter overflow 9:8 cmoa 0x0 rw compare match output action select output action on compare match. value mode description 0 none no action on compare match 1 toggle toggle output on compare match 2 clear clear output on compare match 3 set set output on compare match 7:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 coist 0 rw compare output initial state this bit is only used in output compare and pwm mode. when this bit is set in compare mode,the output is set high when the counter is disabled. when counting resumes, this value will represent the initial value for the output. if the bit is cleared, the output will be cleared when the counter is disabled. in pwm mode, the output will always be low when disabled, regardless of this bit. however, this bit will represent the initial value of the output, once it is enabled. 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 outinv 0 rw output invert setting this bit inverts the output from the cc channel (output compare,pwm). 1:0 mode 0x0 rw cc channel mode these bits select the mode for compare/capture channel. value mode description 0 off compare/capture channel turned off 1 inputcapture input capture 2 outputcompare output compare 3 pwm pulse-width modulation
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 549 www.energymicro.com 20.5.13 timern_ccx_ccv - cc channel value register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rwh name ccv bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 ccv 0x0000 rwh cc channel value in input capture mode, this field holds the first unread capture value. when reading this register in input capture mode, then contents of the timern_ccx_ccvb register will be written to timern_ccx_ccv in the next cycle. in compare mode, this fields holds the compare value. 20.5.14 timern_ccx_ccvp - cc channel value peek register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access r name ccvp bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 ccvp 0x0000 r cc channel value peek this field is used to read the cc value without pulling data through the fifo in capture mode. 20.5.15 timern_ccx_ccvb - cc channel buffer register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rwh name ccvb
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 550 www.energymicro.com bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 ccvb 0x0000 rwh cc channel value buffer in input capture mode, this field holds the last capture value if the timern_ccx_ccv register already contains an earlier unread capture value. in output compare or pwm mode, this field holds the cc buffer value which will be written to timern_ccx_ccv on an update event if timern_ccx_ccvb contains valid data. 20.5.16 timern_dtctrl - dti control register offset bit position 0x070 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 0 0 0 0 access rw rw rw rw rw rw name dtprsen dtprssel dtcinv dtipol dtdas dten bit name reset access description 31:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24 dtprsen 0 rw dti prs source enable enable/disable prs as dti input. 23:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:4 dtprssel 0x0 rw dti prs source channel select select which prs channel to listen to. value mode description 0 prsch0 prs channel 0 selected as input 1 prsch1 prs channel 1 selected as input 2 prsch2 prs channel 2 selected as input 3 prsch3 prs channel 3 selected as input 4 prsch4 prs channel 4 selected as input 5 prsch5 prs channel 5 selected as input 6 prsch6 prs channel 6 selected as input 7 prsch7 prs channel 7 selected as input 8 prsch8 prs channel 8 selected as input 9 prsch9 prs channel 9 selected as input 10 prsch10 prs channel 10 selected as input 11 prsch11 prs channel 11 selected as input 3 dtcinv 0 rw dti complementary output invert. set to invert complementary outputs. 2 dtipol 0 rw dti inactive polarity set inactive polarity for outputs. 1 dtdas 0 rw dti automatic start-up functionality configure dti restart on debugger exit. value mode description 0 norestart no dti restart on debugger exit 1 restart dti restart on debugger exit 0 dten 0 rw dti enable enable/disable dti.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 551 www.energymicro.com 20.5.17 timern_dttime - dti time control register offset bit position 0x074 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x00 0x0 access rw rw rw name dtfallt dtriset dtpresc bit name reset access description 31:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21:16 dtfallt 0x00 rw dti fall-time set time span for the falling edge. value description dtfallt fall time of dtfallt+1 prescaled hfperclk cycles 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 dtriset 0x00 rw dti rise-time set time span for the rising edge. value description dtriset rise time of dtriset+1 prescaled hfperclk cycles 7:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 dtpresc 0x0 rw dti prescaler setting select prescaler for dti. value mode description 0 div1 the hfperclk is undivided 1 div2 the hfperclk is divided by 2 2 div4 the hfperclk is divided by 4 3 div8 the hfperclk is divided by 8 4 div16 the hfperclk is divided by 16 5 div32 the hfperclk is divided by 32 6 div64 the hfperclk is divided by 64 7 div128 the hfperclk is divided by 128 8 div256 the hfperclk is divided by 256 9 div512 the hfperclk is divided by 512 10 div1024 the hfperclk is divided by 1024 20.5.18 timern_dtfc - dti fault configuration register offset bit position 0x078 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0x0 0x0 0x0 access rw rw rw rw rw rw rw name dtlockupfen dtdbgfen dtprs1fen dtprs0fen dtfa dtprs1fsel dtprs0fsel
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 552 www.energymicro.com bit name reset access description 31:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27 dtlockupfen 0 rw dti lockup fault enable set this bit to 1 to enable core lockup as a fault source 26 dtdbgfen 0 rw dti debugger fault enable set this bit to 1 to enable debugger as a fault source 25 dtprs1fen 0 rw dti prs 1 fault enable set this bit to 1 to enable prs source 1(prs channel determined by dtprs1fsel) as a fault source 24 dtprs0fen 0 rw dti prs 0 fault enable set this bit to 1 to enable prs source 0(prs channel determined by dtprs0fsel) as a fault source 23:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 dtfa 0x0 rw dti fault action select fault action. value mode description 0 none no action on fault 1 inactive set outputs inactive 2 clear clear outputs 3 tristate tristate outputs 15:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 dtprs1fsel 0x0 rw dti prs fault source 1 select select prs channel for fault source 1. value mode description 0 prsch0 prs channel 0 selected as fault source 1 1 prsch1 prs channel 1 selected as fault source 1 2 prsch2 prs channel 2 selected as fault source 1 3 prsch3 prs channel 3 selected as fault source 1 4 prsch4 prs channel 4 selected as fault source 1 5 prsch5 prs channel 5 selected as fault source 1 6 prsch6 prs channel 6 selected as fault source 1 7 prsch7 prs channel 7 selected as fault source 1 7:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2:0 dtprs0fsel 0x0 rw dti prs fault source 0 select select prs channel for fault source 0. value mode description 0 prsch0 prs channel 0 selected as fault source 0 1 prsch1 prs channel 1 selected as fault source 0 2 prsch2 prs channel 2 selected as fault source 0 3 prsch3 prs channel 3 selected as fault source 0 4 prsch4 prs channel 4 selected as fault source 0 5 prsch5 prs channel 5 selected as fault source 0 6 prsch6 prs channel 6 selected as fault source 0 7 prsch7 prs channel 7 selected as fault source 0
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 553 www.energymicro.com 20.5.19 timern_dtogen - dti output generation enable register offset bit position 0x07c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name dtogcdti2en dtogcdti1en dtogcdti0en dtogcc2en dtogcc1en dtogcc0en bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 dtogcdti2en 0 rw dti cdti2 output generation enable this bit enables/disables output generation for the cdti2 output from the dti. 4 dtogcdti1en 0 rw dti cdti1 output generation enable this bit enables/disables output generation for the cdti1 output from the dti. 3 dtogcdti0en 0 rw dti cdti0 output generation enable this bit enables/disables output generation for the cdti0 output from the dti. 2 dtogcc2en 0 rw dti cc2 output generation enable this bit enables/disables output generation for the cc2 output from the dti. 1 dtogcc1en 0 rw dti cc1 output generation enable this bit enables/disables output generation for the cc1 output from the dti. 0 dtogcc0en 0 rw dti cc0 output generation enable this bit enables/disables output generation for the cc0 output from the dti. 20.5.20 timern_dtfault - dti fault register offset bit position 0x080 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access r r r r name dtlockupf dtdbgf dtprs1f dtprs0f bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 dtlockupf 0 r dti lockup fault this bit is set to 1 if a core lockup fault has occurred and dtlockupfen is set to 1. the timer0_dtfaultc register can be used to clear fault bits. 2 dtdbgf 0 r dti debugger fault this bit is set to 1 if a debugger fault has occurred and dtdbgfen is set to 1. the timer0_dtfaultc register can be used to clear fault bits. 1 dtprs1f 0 r dti prs 1 fault this bit is set to 1 if a prs 1 fault has occurred and dtprs1fen is set to 1. the timer0_dtfaultc register can be used to clear fault bits.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 554 www.energymicro.com bit name reset access description 0 dtprs0f 0 r dti prs 0 fault this bit is set to 1 if a prs 0 fault has occurred and dtprs0fen is set to 1. the timer0_dtfaultc register can be used to clear fault bits. 20.5.21 timern_dtfaultc - dti fault clear register offset bit position 0x084 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name tlockupfc dtdbgfc dtprs1fc dtprs0fc bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 tlockupfc 0 w1 dti lockup fault clear write 1 to this bit to clear core lockup fault. 2 dtdbgfc 0 w1 dti debugger fault clear write 1 to this bit to clear debugger fault. 1 dtprs1fc 0 w1 dti prs1 fault clear write 1 to this bit to clear prs 1 fault. 0 dtprs0fc 0 w1 dti prs0 fault clear write 1 to this bit to clear prs 0 fault. 20.5.22 timern_dtlock - dti configuration lock register offset bit position 0x088 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name lockkey bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 lockkey 0x0000 rw dti lock key write any other value than the unlock code to lock timer0_route, timer0_dtctrl, timer0_dttime and timer0_dtfc from editing. write the unlock code to unlock. when reading the register, bit 0 is set when the lock is enabled. mode value description read operation unlocked 0 timer dti registers are unlocked locked 1 timer dti registers are locked
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 555 www.energymicro.com bit name reset access description mode value description write operation lock 0 lock timer dti registers unlock 0xce80 unlock timer dti registers
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 556 www.energymicro.com 21 rtc - real time counter 0 1 2 3 0 1 2 3 quick facts what? the real time counter (rtc) ensures timekeeping in low energy modes. combined with the low power 32.768 khz oscillator (xtal or rc), the rtc can run in em2 with total current consumption less than 0.95 a. why? timekeeping over long time periods is required in many applications, while using as little power as possible. how? the 32.768 khz oscillator is used as clock signal and the rtc has two different compare registers that can trigger a wake-up. 24-bit resolution and selectable prescaling allow the system to stay in em2 for long a time and still maintain reliable timekeeping. 21.1 introduction the real time counter (rtc) contains a 24-bit counter and is clocked either by a 32.768 khz crystal oscillator, or a 32.768 khz rc oscillator. in addition to energy modes em0 and em1, the rtc is also available in em2. this makes it ideal for keeping track of time since the rtc is enabled in em2 where most of the device is powered down. two compare channels are available in the rtc. these can be used to trigger interrupts and to wake the device up from a low energy mode. they can also be used with the letimer to generate various output waveforms. 21.2 features ? 24-bit real time counter. ? prescaler ? 32.768 khz/2 n , n = 0 - 15. ? overflow @ 0.14 hours for prescaler setting = 0. ? overflow @ 4660 hours (194 days) for prescaler setting = 15 (1 s tick). ? two compare registers ? a compare match can potentially wake-up the device from low energy modes em1 and em2. ? second compare register can be top value for rtc. ? both compare channels can trigger letimer. ? compare match events are available to other peripherals through the peripheral reflex system (prs). 21.3 functional description the rtc is a 24-bit counter with two compare channels. the rtc is closely coupled with the letimer, and can be configured to trigger it on a compare match on one or both compare channels. an overview of the rtc module is shown in figure 21.1 (p. 557 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 557 www.energymicro.com figure 21.1. rtc overview count er (cnt) peripheral bus = com pare m at ch 1 com pare m at ch 0 rtc cont rol and st at us = lfaclk rtc com pare 0 ( comp0) com pare 1 ( comp1) clear 21.3.1 counter the rtc is enabled by setting the en bit in the rtc_ctrl register. it counts up as long as it is enabled, and will on an overflow simply wrap around and continue counting. the rtc is cleared when it is disabled. the timer value is both readable and writable and the rtc always starts counting from 0 when enabled. the value of the counter can be read or modified using the rtc_cnt register. 21.3.1.1 clock source the rtc clock source and its prescaler value are defined in the register description section of the clock management unit (cmu). the clock used by the rtc has a frequency given by equation 21.1 (p. 557 ) . rtc frequency equation f rtc = f lfaclk /2 rtc_presc (21.1) where f lfaclk is the lfaclk frequency (32.768 khz) and rtc_presc is a 4 bit value. table 21.1 (p. 558 ) shows the time of overflow and resolution of the rtc at the available prescaler values. to use this module, the le interface clock must be enabled in cmu_hfcoreclken0 in addition to the module clock
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 558 www.energymicro.com table 21.1. rtc resolution vs overflow rtc_presc resolution overflow 0 30,5 s 512 s 1 61,0 s 1024 s 2 122 s 2048 s 3 244 s 1,14 hours 4 488 s 2,28 hours 5 977 s 4,55 hours 6 1,95 ms 9,10 hours 7 3,91 ms 18,2 hours 8 7,81 ms 1,52 days 9 15,6 ms 3,03 days 10 31,25 ms 6,07 days 11 62,5 ms 12,1 days 12 0,125 s 24,3 days 13 0,25 s 48,5 days 14 0,5 s 97,1 days 15 1 s 194 days 21.3.2 compare channels two compare channels are available in the rtc. the compare values can be set by writing to the rtc compare channel registers rtc_compn, and when rtc_cnt is equal to one of these, the respective compare interrupt flag compn is set. if comp0top is set, the compare value set for compare channel 0 is used as a top value for the rtc, and the timer is cleared on a compare match with compare channel 0. if using the comp0top setting, make sure to set this bit prior to or at the same time the en bit is set. setting comp0top after the en bit is set may cause unintended operation (i.e. if cnt > comp0). 21.3.2.1 letimer triggers a compare event on either of the compare channels can start the letimer. see the letimer documentation for more information on this feature. 21.3.2.2 prs sources both the compare channels of the rtc can be used as prs sources. they will generate a pulse lasting one rtc clock cycle on a compare match. 21.3.3 interrupts the interrupts generated by the rtc are combined into one interrupt vector. if interrupts for the rtc is enabled, an interrupt will be made if one or more of the interrupt flags in rtc_if and their corresponding bits in rtc_ien are set. interrupt events are overflow and compare match on either compare channels. clearing of an interrupt flag is performed by writing to the corresponding bit in the rtc_ifc register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 559 www.energymicro.com 21.3.4 debugrun by default, the rtc is halted when code execution is halted from the debugger. by setting the debugrun bit in the rtc_ctrl register, the rtc will continue to run even when the debugger is halted. 21.3.5 register access this module is a low energy peripheral, and supports immediate synchronization. for description regarding immediate synchronization, the reader is referred to section 5.3.1.1 (p. 22 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 560 www.energymicro.com 21.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 rtc_ctrl rw control register 0x004 rtc_cnt rwh counter value register 0x008 rtc_comp0 rw compare value register 0 0x00c rtc_comp1 rw compare value register 1 0x010 rtc_if r interrupt flag register 0x014 rtc_ifs w1 interrupt flag set register 0x018 rtc_ifc w1 interrupt flag clear register 0x01c rtc_ien rw interrupt enable register 0x020 rtc_freeze rw freeze register 0x024 rtc_syncbusy r synchronization busy register 21.5 register description 21.5.1 rtc_ctrl - control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access rw rw rw name comp0top debugrun en bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 comp0top 0 rw compare channel 0 is top value when set, the counter is cleared in the clock cycle after a compare match with compare channel 0. value mode description 0 disable the top value of the rtc is 16777215 (0xffffff) 1 enable the top value of the rtc is given by comp0 1 debugrun 0 rw debug mode run enable set this bit to enable the rtc to keep running in debug. value description 0 rtc is frozen in debug mode 1 rtc is running in debug mode 0 en 0 rw rtc enable when this bit is set, the rtc is enabled and counts up. when cleared, the counter register cnt is reset.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 561 www.energymicro.com 21.5.2 rtc_cnt - counter value register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000000 access rwh name cnt bit name reset access description 31:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23:0 cnt 0x000000 rwh counter value gives access to the counter value of the rtc. 21.5.3 rtc_comp0 - compare value register 0 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000000 access rw name comp0 bit name reset access description 31:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23:0 comp0 0x000000 rw compare value 0 a compare match event occurs when cnt is equal to this value. this event sets the comp0 interrupt flag, and can be used to start the letimer. it is also available as a prs signal. 21.5.4 rtc_comp1 - compare value register 1 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 562 www.energymicro.com offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000000 access rw name comp1 bit name reset access description 31:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23:0 comp1 0x000000 rw compare value 1 a compare match event occurs when cnt is equal to this value. this event sets comp1 interrupt flag, and can be used to start the letimer. it is also available as a prs signal. 21.5.5 rtc_if - interrupt flag register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access r r r name comp1 comp0 of bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 comp1 0 r compare match 1 interrupt flag set on a compare match between cnt and comp1. 1 comp0 0 r compare match 0 interrupt flag set on a compare match between cnt and comp0. 0 of 0 r overflow interrupt flag set on a cnt value overflow. 21.5.6 rtc_ifs - interrupt flag set register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access w1 w1 w1 name comp1 comp0 of
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 563 www.energymicro.com bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 comp1 0 w1 set compare match 1 interrupt flag write to 1 to set the comp1 interrupt flag. 1 comp0 0 w1 set compare match 0 interrupt flag write to 1 to set the comp0 interrupt flag. 0 of 0 w1 set overflow interrupt flag write to 1 to set the of interrupt flag. 21.5.7 rtc_ifc - interrupt flag clear register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access w1 w1 w1 name comp1 comp0 of bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 comp1 0 w1 clear compare match 1 interrupt flag write to 1 to clear the comp1 interrupt flag. 1 comp0 0 w1 clear compare match 0 interrupt flag write to 1 to clear the comp0 interrupt flag. 0 of 0 w1 clear overflow interrupt flag write to 1 to clear the of interrupt flag. 21.5.8 rtc_ien - interrupt enable register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access rw rw rw name comp1 comp0 of bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 comp1 0 rw compare match 1 interrupt enable enable interrupt on compare match 1. 1 comp0 0 rw compare match 0 interrupt enable enable interrupt on compare match 0. 0 of 0 rw overflow interrupt enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 564 www.energymicro.com bit name reset access description enable interrupt on overflow. 21.5.9 rtc_freeze - freeze register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name regfreeze bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 regfreeze 0 rw register update freeze when set, the update of the rtc is postponed until this bit is cleared. use this bit to update several registers simultaneously. value mode description 0 update each write access to an rtc register is updated into the low frequency domain as soon as possible. 1 freeze the rtc is not updated with the new written value until the freeze bit is cleared. 21.5.10 rtc_syncbusy - synchronization busy register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access r r r name comp1 comp0 ctrl bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 comp1 0 r comp1 register busy set when the value written to comp1 is being synchronized. 1 comp0 0 r comp0 register busy set when the value written to comp0 is being synchronized. 0 ctrl 0 r ctrl register busy set when the value written to ctrl is being synchronized.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 565 www.energymicro.com 22 burtc - backup real time counter 0 1 2 3 4 0 1 2 3 4 quick facts what? the backup real time counter (burtc) allows timekeeping in all energy modes. running on the lfxo, lfrco, or ulfrco, the burtc can run in em4 with a total current consumption less than 0.5ua. the backup rtc is also available when the system is in backup mode. why? timekeeping over long time periods is required in many applications, while using as little power as possible. how? the 32-bit backup rtc is available in all energy modes and selectable prescaling allows the system to stay in low energy modes for long a time and still maintain reliable timekeeping. the burtc also includes a feature allowing seamless switching of clock frequency, while maintaining resolution of the counter. 22.1 introduction the backup real time counter (burtc) contains a 32-bit counter and is clocked either by a 32.768 khz crystal oscillator, a 32.768 khz rc oscillator, a 2khz rc oscillator, or a 1khz rc oscillator. a variety of prescaler settings are also available for the 32.768 khz oscillators. the backup rtc is available in all energy modes, making it ideal for time keeping with minimal energy consumption. the ability to keep running while the system is in backup mode allows the backup rtc to keep track of time, even if the main power should drain out. 22.2 features ? 32-bit real time counter ? prescaler for lfxo and lfrco, 32.768 khz/2 n , n = 0-7 ? available in all energy modes and backup mode. ? timestamp and optionally switch to low power mode upon entry to backup mode. ? oscillator failure detection. ? em4 operation and wake-up. ? not reset by system reset, only by software, pin reset, or power loss. ? seamless frequency shifting while keeping track of time. ? 512 bytes of general purpose data retention. ? detection of corrupt writes to retention registers when losing main power. ? prs producer.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 566 www.energymicro.com 22.3 functional description the backup rtc is a 32-bit counter with one compare channel. the backup rtc resides in a power domain which can be configured to always be on, in em0 through em4. this domain also has the possibility to be powered by a backup battery. for further details on the backup power domain, refer to section 10.3.4 (p. 111 ) . available in all energy modes, the backup rtc is ideal for applications where keeping track of time in combination with extremely low energy consumption is essential. an overview of the backup rtc is shown in figure 22.1 (p. 566 ) . figure 22.1. burtc overview count er (cnt) peripheral bus com pare m at ch comp0 clear comp0top lfxo lfrco clksel rtc cont rol and st at us cnt = comp0 * * num ber of bit s evaluat ed varies in low power m ode ulfrco 2 - presc 22.3.1 counter the backup rtc is enabled by configuring mode in the burtc_ctrl register. this configuration of mode determines in which energy modes the backup rtc is operational. it will always be operational in em0-em2, and optionally in em3 and em4. the backup rtc is available when the system is in backup mode if mode is set to em4en. the counter is cleared by setting rsten in the control register. a system reset will not clear the counter. the counter value can be read through the cnt register. 22.3.2 clock source the backup rtc is clocked by lfxo, lfrco, or ulfrco, depending on the configuration of clksel in burtc_ctrl. the presc bit-field in burtc_ctrl controls the clock prescaling factor. prescaler is only available for lfxo and lfrco. when using the ulfrco as clock source, only two frequency options are available; 2khz and 1khz. the 2khz clock is selected when presc in burtc_ctrl is set to div1, and the 1khz clock is selected when presc is set to any other value. available frequencies when using lfxo or lfrco are given in equation 22.1 (p. 566 ) . clksel should not be changed while the backup rtc is running. burtc frequency equation f burtc = 32768/2 presc hz, presc = 0..7 (22.1) when the lfxo or lfrco is enabled, the backup rtc will not use the clock until the timeout defined in the cmu has run out, i.e. the lfxordy/lfrcordy flag in cmu_status is set. when an oscillator first has been enabled and is used by the backup rtc, the backup rtc will keep the selected clock source enabled, independent of both energy mode and cmu settings. 22.3.3 compare channel the backup rtc has one compare channel. the compare value is set by writing to the comp0 register. when the value of cnt equals the value of comp0, the comp0 interrupt flag is set. if comp0top in ctrl is set, the counter will wrap around when reaching the value in the compare register, comp. if comp0top is cleared, the counter will continue counting, wrapping around when it overflows. on overflow, the of interrupt flag is set.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 567 www.energymicro.com 22.3.4 prs sources the compare channel of the backup rtc can be used as prs source. a pulse lasting one clock cycle will be generated on a compare match. a prs pulse will also be generated on overflow. 22.3.5 debugrun by default, the backup rtc is halted when code execution is halted by the debugger. by setting the debugrun bit in the ctrl register, the backup rtc will continue to run even when the system is halted. 22.3.6 low power mode the backup rtc has a low power mode which lowers the power consumption at the expense of decreased resolution on compare matches. the low power mode is enabled by configuring the lpmode bit-field in burtc_ctrl. when lpmode is set to enable, low power mode is always enabled, if lpmode is set to buen, the backup rtc operates in normal mode until the system enters backup mode, refer to section 10.3.4 (p. 111 ) for details on backup mode. when the backup rtc operates in low power mode, a configurable number of the lsbs of comp0 are ignored for compare match evaluation. the number of bits ignored is configured in the lpcomp bit-field in the burtc_ctrl register. equation 22.2 (p. 567 ) is used to calculate compare match resolution in low power mode. in low power mode, the backup rtc will decrease its frequency by a factor of 2 -lpcomp , and start incrementing with 2 lpcomp instead of 1. when reading the counter value from software, full resolution is maintained, the decrease in frequency will only affect the resolution on compare matches. low power mode can be entered and exited while the backup rtc is running. when the backup rtc is operating in low power mode, lpmodeact in burtc_status is set. low power mode compare match resolution cm resolution = 2 presc + lpcomp + 1 / f clk , presc + lpcomp + 1 < 9 (22.2) table 22.1. resolution and overflow normal mode low power mode presc compare match resolution overflow compare match resolution overflow 0 30.5 s 1.52 days equation 22.2 (p. 567 ) 1.52 days 1 61 s 3.03 days equation 22.2 (p. 567 ) 3.03 days 2 122 s 6.07 days equation 22.2 (p. 567 ) 6.07 days 3 244 s 12.14 days equation 22.2 (p. 567 ) 12.14 days 4 488 s 24.27 days equation 22.2 (p. 567 ) 24.27 days 5 977 s 48.54 days equation 22.2 (p. 567 ) 48.54 days 6 1.95 ms 97.09 days equation 22.2 (p. 567 ) 97.09 days 7 3.91 ms 194.18 days equation 22.2 (p. 567 ) 194.18 days note
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 568 www.energymicro.com low power mode is only available when using lfxo or lfrco. 22.3.7 retention registers the backup rtc includes 128 x 32 bit registers with possible retention in all energy modes. the registers are accessible through the retx_reg registers. retention is by default enabled in em0 through em4. the registers can be shut off to save power by setting ram in burtc_powerdown. note that the retention registers cannot be accessed when rsten in burtc_ctrl is set. note the retention registers are mapped to a ram instance and have undefined state out of reset. if the system should lose main power and enter backup mode while writing to the retention registers, the ram write error flag, ramwerr, in burtc_status will be set, and the attempted write will be canceled. the ramwerr flag is cleared by writing a 1 to clrstatus in burtc_cmd. 22.3.8 backup operation the backup rtc and the retention registers reside in a separate power domain, which in addition to being available in em4 has the possibility to be powered by a backup battery. refer to section 10.3.4 (p. 111 ) for further details on this power domain. 22.3.9 backup mode timestamp the backup rtc includes functionality for storing a timestamp when the system enters backup mode. the timestamp is stored in the burtc_timestamp register. if low power mode is enabled, ignored bits will not be stored in the timestamp register. timestamping is enabled by setting bumodetsen in burtc_ctrl. when a timestamp is stored, the bumodets bit in buctrl_status is set. to prevent uncontrolled time stamping when entering and exiting backup mode, this status bit has to be cleared before a new timestamp can be stored. writing a 1 to clrstatus in burtc_cmd clears bumodets. 22.3.10 lfxo failure detection to be able to detect lfxo failure, the backup rtc includes a five bit down counter with configurable top value. the top value is configured in top in burtc_lfxofdet. the counter starts at the top value and counts downwards on either lfrco or ulfrco, depending on the configuration of osc in burtc_lfxofdet. when lfrco is selected as clock for the down counter, it will be prescaled with a factor of 2 presc + lpcomp . the counter wraps to top when it reaches zero. if no lfxo clock has arrived since the last time the counter reached zero , the burtc clock is changed to the clock source configured in osc and the lfxofail interrupt flag is set. note that due to synchronization, the lfxo clock needs to arrive at least two cycles before the counter reaches zero. 22.3.11 register access most backup rtc configuration should not be changed while the counter is running, i.e. they should only be changed while rsten in burtc_ctrl is set. registers allowed to change run-time are burtc_comp0, burtc_lpmode, and debugrun in burtc_ctrl. for further details on access to these registers, refer to section 5.3 (p. 21 ) . note the backup domain has its own reset signal which is active when the device powers up for the first time. the reset is deactivated by clearing bursten in rmu_ctrl. this has to be done before any registers in the backup rtc can be accessed.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 569 www.energymicro.com 22.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 burtc_ctrl rw control register 0x004 burtc_lpmode rw low power mode configuration 0x008 burtc_cnt r counter value register 0x00c burtc_comp0 rw counter compare value 0x010 burtc_timestamp r backup mode timestamp 0x014 burtc_lfxofdet rw lfxo 0x018 burtc_status r status register 0x01c burtc_cmd w1 command register 0x020 burtc_powerdown rw retention ram power-down register 0x024 burtc_lock rw configuration lock register 0x028 burtc_if r interrupt flag register 0x02c burtc_ifs w1 interrupt flag set register 0x030 burtc_ifc w1 interrupt flag clear register 0x034 burtc_ien rw interrupt enable register 0x038 burtc_freeze rw freeze register 0x03c burtc_syncbusy r synchronization busy register 0x100 ret0_reg rw retention register ... retx_reg rw retention register 0x2fc ret127_reg rw retention register 22.5 register description 22.5.1 burtc_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 0x0 0x0 0 1 0 0x0 access rw rw rw rw rw rw rw rw name bumodetsen clksel presc lpcomp comp0top rsten debugrun mode bit name reset access description 31:15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14 bumodetsen 0 rw backup mode timestamp enable when set, the burtc will store its counter value in the burtc_timestamp register upon backup mode entry. 13:12 clksel 0x0 rw select burtc clock source value mode description 0 none no clock source selected for burtc.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 570 www.energymicro.com bit name reset access description value mode description 1 lfrco lfrco selected as burtc clock source. 2 lfxo lfxo selected as burtc clock source. 3 ulfrco ulfrco selected as burtc clock source. 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 presc 0x0 rw select burtc prescaler factor the burtc will be prescaled by a factor of 2 presc value mode description 0 div1 no prescaling. 1 div2 prescaling factor of 2 2 div4 prescaling factor of 4 3 div8 prescaling factor of 8 4 div16 prescaling factor of 16 5 div32 prescaling factor of 32 6 div64 prescaling factor of 64 7 div128 prescaling factor of 128 7:5 lpcomp 0x0 rw low power mode compare configuration this bit-field configures which bits to be evaluated for compare match in low power mode. value mode description 0 ign0lsb do not ignore any bits for compare match evaluation. 1 ign1lsb the lsb of the counter is ignored for compare match evaluation. 2 ign2lsb the two lsbs of the counter are ignored for compare match evaluation. 3 ign3lsb the three lsbs of the counter are ignored for compare match evaluation. 4 ign4lsb the four lsbs of the counter are ignored for compare match evaluation. 5 ign5lsb the five lsbs of the counter are ignored for compare match evaluation. 6 ign6lsb the six lsbs of the counter are ignored for compare match evaluation. 7 ign7lsb the seven lsbs of the counter are ignored for compare match evaluation. 4 comp0top 0 rw compare clear enable when set, the counter wraps around when cnt equals comp0 3 rsten 1 rw enable burtc reset reset the backup rtc. register values are not reset. 2 debugrun 0 rw debug mode run enable set this bit to keep the burtc running during a debug halt. value description 0 rtc is frozen in debug mode 1 rtc is running in debug mode 1:0 mode 0x0 rw burtc enable configure in which energy modes the burtc should keep running. value mode description 0 disable the burtc is disabled. 1 em2en the burtc is in normal operating mode, operating in em0-em2. oscillators must be enabled in cmu for use. 2 em3en the burtc is enabled in em0-em3. will prevent cmu from disabling used oscillators all the way down to em3. 3 em4en the burtc is enabled in em0-em4. will prevent cmu from disabling used oscillators all the way down to em4. 22.5.2 burtc_lpmode - low power mode configuration (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 571 www.energymicro.com offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 access rw name lpmode bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 lpmode 0x0 rw low power mode configuration. value mode description 0 disable low power mode is disabled. 1 enable low power mode always enabled. 2 buen low power mode enabled in backup mode. 22.5.3 burtc_cnt - counter value register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access r name cnt bit name reset access description 31:0 cnt 0x00000000 r counter value gives access to the burtc counter value. 22.5.4 burtc_comp0 - counter compare value (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 572 www.energymicro.com offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name comp0 bit name reset access description 31:0 comp0 0x00000000 rw compare match value gives access to the burtc compare value. 22.5.5 burtc_timestamp - backup mode timestamp offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access r name timestamp bit name reset access description 31:0 timestamp 0x00000000 r backup mode timestamp. contains the timestamp stored upon backup mode entry. 22.5.6 burtc_lfxofdet - lfxo offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 0x0 access rw rw name top osc
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 573 www.energymicro.com bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:4 top 0x00 rw lfxo failure counter top value. lfxo failure counter will wrap to this value when reaching zero. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 osc 0x0 rw lfxo failure detection configuration. select oscillator for lfxo failure detection. value mode description 0 disable lfxo failure detection disabled. 1 lfrco lfrco used for lfxo failure detection. 2 ulfrco ulfrco used for lfxo failure detection. 22.5.7 burtc_status - status register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access r r r name ramwerr bumodets lpmodeact bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 ramwerr 0 r ram write error. set if backup mode is entered during a write to the retention ram. 1 bumodets 0 r timestamp for backup mode entry stored. set when a timestamp has been stored in burtc_timestamp. 0 lpmodeact 0 r low power mode active set when the burtc is in low power mode 22.5.8 burtc_cmd - command register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name clrstatus bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 clrstatus 0 w1 clear burtc_status register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 574 www.energymicro.com bit name reset access description clear ramwerr and bumodets in burtc_status. 22.5.9 burtc_powerdown - retention ram power-down register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name ram bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 ram 0 rw retention ram power-down shut off power to the retention ram. once it is powered down, it cannot be powered up again 22.5.10 burtc_lock - configuration lock register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name lockkey bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 lockkey 0x0000 rw configuration lock key write any other value than the unlock code to lock burtc_powerdown, burtc_ctrl, burtc_lfxofdet, and burtc_ien registers from editing. write the unlock code to unlock. when reading the register, bit 0 is set when the lock is enabled. mode value description read operation unlocked 0 burtc_powerdown, burtc_ctrl, burtc_lfxofdet, and burtc_ien registers are unlocked locked 1 burtc_powerdown, burtc_ctrl, burtc_lfxofdet, and burtc_ien registers are locked write operation lock 0 lock burtc_powerdown, burtc_ctrl, burtc_lfxofdet, and burtc_ien registers unlock 0xaee8 unlock burtc registers
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 575 www.energymicro.com 22.5.11 burtc_if - interrupt flag register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access r r r name lfxofail comp0 of bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 lfxofail 0 r lfxo failure interrupt flag set on lfxo failure. 1 comp0 0 r compare match interrupt flag set on burtc compare match. 0 of 0 r overflow interrupt flag set on burtc overflow. 22.5.12 burtc_ifs - interrupt flag set register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access w1 w1 w1 name lfxofail comp0 of bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 lfxofail 0 w1 set lfxo fail interrupt flag write to 1 to set the lfxofail interrupt flag 1 comp0 0 w1 set compare match interrupt flag write to 1 to set the comp0 interrupt flag 0 of 0 w1 set overflow interrupt flag write to 1 to set the of interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 576 www.energymicro.com 22.5.13 burtc_ifc - interrupt flag clear register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access w1 w1 w1 name lfxofail comp0 of bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 lfxofail 0 w1 clear lfxo failure interrupt flag write to 1 to clear the lfxofail interrupt flag 1 comp0 0 w1 clear compare match interrupt flag write to 1 to clear the comp0 interrupt flag 0 of 0 w1 clear overflow interrupt flag write to 1 to clear the of interrupt flag 22.5.14 burtc_ien - interrupt enable register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access rw rw rw name lfxofail comp0 of bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 lfxofail 0 rw lfxo failure interrupt enable enable interrupt on lfxo failure 1 comp0 0 rw compare match interrupt enable enable interrupt on compare match 0 of 0 rw overflow interrupt enable enable interrupt on overflow
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 577 www.energymicro.com 22.5.15 burtc_freeze - freeze register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name regfreeze bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 regfreeze 0 rw register update freeze when set, the update of the burtc is postponed until this bit is cleared. use this bit to update several registers simultaneously. value mode description 0 update each write access to an burtc register is updated into the low frequency domain as soon as possible. 1 freeze the burtc is not updated with the new written value until the freeze bit is cleared. 22.5.16 burtc_syncbusy - synchronization busy register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access r r name comp0 lpmode bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 comp0 0 r comp0 register busy set when the value written to comp0 is being synchronized. 0 lpmode 0 r lpmode register busy set when the value written to lpmode is being synchronized. 22.5.17 retx_reg - retention register offset bit position 0x100 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxxxxxx access rw name reg
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 578 www.energymicro.com bit name reset access description 31:0 reg 0xxxxxxxxx rw general purpose retention register
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 579 www.energymicro.com 23 letimer - low energy timer 0 1 2 3 4 letim er rtc quick facts what? the letimer is a down-counter that can keep track of time and output configurable waveforms. running on a 32.768 khz clock the letimer is available even in em2 with sub a current consumption. why? the letimer can be used to provide repeatable waveforms to external components while remaining in em2. it is well suited for e.g. metering systems or to provide more compare values than available in the rtc. how? with buffered repeat and top value registers, the letimer can provide glitch-free waveforms at frequencies up to 16 khz. it is tightly coupled to the rtc, which allows advanced time-keeping and wake-up functions in em2. 23.1 introduction the unique letimer tm , the low energy timer, is a 16-bit timer that is available in energy mode em2 in addition to em1 and em0. because of this, it can be used for timing and output generation when most of the device is powered down, allowing simple tasks to be performed while the power consumption of the system is kept at an absolute minimum. the letimer can be used to output a variety of waveforms with minimal software intervention. it is also connected to the real time counter (rtc), and can be configured to start counting on compare matches from the rtc. 23.2 features ? 16-bit down count timer ? 2 compare match registers ? compare register 0 can be top timer top value ? compare registers can be double buffered ? double buffered 8-bit repeat register ? same clock source as the real time counter ? letimer can be triggered (started) by an rtc event or by software ? 2 output pins can optionally be configured to provide different waveforms on timer underflow: ? toggle output pin ? apply a positive pulse (pulse width of one lfaclk letimer period) ? pwm ? interrupt on: ? compare matches ? timer underflow
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 580 www.energymicro.com ? repeat done ? optionally runs during debug 23.3 functional description an overview of the letimer module is shown in figure 23.1 (p. 580 ) . the letimer is a 16-bit down-counter with two compare registers, letimern_comp0 and letimern_comp1. the letimern_comp0 register can optionally act as a top value for the counter. the repeat counter letimern_rep0 allows the timer to count a specified number of times before it stops. both the letimern_comp0 and letimern_rep0 registers can be double buffered by the letimern_comp1 and letimern_rep1 registers to allow continuous operation. the timer can generate a single pin output, or two linked outputs. figure 23.1. letimer overview peripheral bus = 0 comp1 ( top buffer) comp0 ( top) cnt (count er) rep0 ( repeat ) rep1 ( repeat buffer) = 1 letimer cont rol and st at us reload updat e updat e st op 0 lfaclk letimern st art rtc event sw pin ct rl letn_o0 pulse cont rol underflow ( uf int errupt flag) rep0 zero ( rep0 int errupt flag) buffer writ t en repeat load logic pin ct rl letn_o1 pulse cont rol top load logic = 1 rep1 zero ( rep1 int errupt flag) = = comp1 mat ch ( comp1 int errupt flag) comp0 mat ch ( comp0 int errupt flag) 23.3.1 timer the timer is started by setting command bit start in letimern_cmd, and stopped by setting the stop command bit in the same register. running in letimern_status is set as long as the timer is running. the timer can also be started on external signals, such as a compare match from the real time counter. if start and stop are set at the same time, stop has priority, and the timer will be stopped. the timer value can be read using the letimern_cnt register. the value cannot be written, but it can be cleared by setting the clear command bit in letimern_cmd. if the clear and start commands are issued at the same time, the timer will be cleared, then start counting at the top value. 23.3.2 compare registers the letimer has two compare match registers, letimern_comp0 and letimern_comp1. each of these compare registers are capable of generating an interrupt when the counter value
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 581 www.energymicro.com letimern_cnt becomes equal to their value. when letimern_cnt becomes equal to the value of letimern_comp0, the interrupt flag comp0 in letimern_if is set, and when letimern_cnt becomes equal to the value of letimern_comp1, the interrupt flag comp1 in letimern_if is set. 23.3.3 top value if comp0top in letimern_ctrl is set, the value of letimern_comp0 acts as the top value of the timer, and letimern_comp0 is loaded into letimern_cnt on timer underflow. else, the timer wraps around to 0xffff. the underflow interrupt flag uf in letimern_if is set when the timer reaches zero. 23.3.3.1 buffered top value if buftop in letimern_ctrl is set, the value of letimern_comp0 is buffered by letimern_comp1. in this mode, the value of letimern_comp1 is loaded into letimern_comp0 every time letimern_rep0 is about to decrement to 0. this can for instance be used in conjunction with the buffered repeat mode to generate continually changing output waveforms. write operations to letimern_comp0 have priority over buffer loads. 23.3.3.2 repeat modes by default, the timer wraps around to the top value or 0xffff on each underflow, and continues counting. the repeat counters can be used to get more control of the operation of the timer, including defining the number of times the counter should wrap around. four different repeat modes are available, see table 23.1 (p. 581 ) . table 23.1. letimer repeat modes repmode mode description 00 free the timer runs until it is stopped 01 one-shot the timer runs as long as letimern_rep0 != 0. letimern_rep0 is decremented at each timer underflow. 10 buffered the timer runs as long as letimern_rep0 != 0. letimern_rep0 is decremented on each timer underflow. if letimern_rep1 has been written, it is loaded into letimern_rep0 when letimern_rep0 is about to be decremented to 0. 11 double the timer runs as long as letimern_rep0 != 0 or letimern_rep1 != 0. both letimern_rep0 and letimern_rep1 are decremented at each timer underflow. the interrupt flags rep0 and rep1 in letimern_if are set whenever letimern_rep0 or letimern_rep1 are decremented to 0 respectively. rep0 is also set when the value of letimern_rep1 is loaded into letimern_rep0 in buffered mode. 23.3.3.2.1 free mode in the free running mode, the letimer acts as a regular timer, and the repeat counter is disabled. when started, the timer runs until it is stopped using the stop command bit in letimern_cmd. a state machine for this mode is shown in figure 23.2 (p. 582 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 582 www.energymicro.com figure 23.2. letimer state machine for free-running mode (running or start) and ! stop yes no cnt = = 0 cnt = cnt - 1 no yes cnt = top* if (stop) running = 0 else if (start) running = 1 end if start = 0 stop = 0 wait for posit ive clock edge if (comp0top) top* = comp0 else top* = 0xffff top* note that the clear command bit in letimern_cmd always has priority over other changes to letimern_cnt. when the clear command is used, letimern_cnt is set to 0 and an underflow event will not be generated when letimern_cnt wraps around to the top value or 0xffff. since no underflow event is generated, no output action is performed. letimern_rep0, letimern_rep1, letimern_comp0 and letimern_comp1 are also left untouched. 23.3.3.2.2 one-shot mode the one-shot repeat mode is the most basic repeat mode. in this mode, the repeat register letimern_rep0 is decremented every time the timer underflows, and the timer stops when letimern_rep0 goes from 1 to 0. in this mode, the timer counts down letimern_rep0 times, i.e. the timer underflows letimern_rep0 times. note note that write operations to letimern_rep0 have priority over the decrementation operation. so if letimern_rep0 is assigned a new value in the same cycle it was supposed to be decremented, it is assigned the new value instead of being decremented. letimern_rep0 can be written while the timer is running to allow the timer to run for longer periods at a time without stopping. figure 23.3 (p. 583 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 583 www.energymicro.com figure 23.3. letimer one-shot repeat state machine running yes cnt = = 0 cnt = cnt - 1 no rep0 < 2 yes no stop = 1 rep 0 = 0 cnt = top* if (! start) rep0 = rep0 - 1 if (stop) running = 0 else if (start) running = 1 end if start = 0 stop = 0 wait for posit ive clock edge yes if (! comp0top) top* * = 0xffff else if (compbuf) top* * = comp1 else top* * = comp0 if (comp0top) top* = comp0 else top* = 0xffff top* top* * start yes cnt = = 0 rep0 = = 0 yes cnt = cnt - 1 cnt = top* no no yes no no 23.3.3.2.3 buffered mode the buffered repeat mode allows buffered timer operation. when started, the timer runs letimern_rep0 number of times. if letimern_rep1 has been written since the last time it was used and it is nonzero, letimern_rep1 is then loaded into letimern_rep0, and counting continues the new number of times. the timer keeps going as long as letimern_rep1 is updated with a nonzero value before letimern_rep0 is finished counting down. if the timer is started when both letimern_cnt and letimern_rep0 are zero but letimern_rep1 is non-zero, letimern_rep1 is loaded into letimern_rep0, and the counter counts the loaded number of times. the state machine for the one-shot repeat mode is shown in figure 23.3 (p. 583 ) . used in conjunction with a buffered top value, enabled by setting buftop in letimern_ctrl, the buffered mode allows buffered values of both the top and repeat values of the timer, and the timer can for instance be set to run 4 times with period 7 (top value 6), 6 times with period 200, then 3 times with period 50. a state machine for the buffered repeat mode is shown in figure 23.4 (p. 584 ) . rep1 used shown in the state machine is an internal variable that keeps track of whether the value in letimern_rep1 has been loaded into letimern_rep0 or not. the purpose of this is that a value written to letimern_rep1 should only be counted once. rep1 used is cleared whenever letimern_rep1 is written.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 584 www.energymicro.com figure 23.4. letimer buffered repeat state machine running yes cnt = = 0 cnt = cnt - 1 no rep0 < 2 yes ! rep1 used and ! rep1 ! = 0 cnt = top* if (buftop) comp0 = comp1 rep 0 = rep1 rep 1 used = 1 no yes stop = 1 rep 0 = 0 no cnt = top* if (! start) rep0 = rep0 - 1 if (stop) running = 0 else if (start) running = 1 end if start = 0 stop = 0 wait for posit ive clock edge yes if (! comp0top) top* * = 0xffff else if (buftop) top* * = comp1 else top* * = comp0 if (comp0top) top* = comp0 else top* = 0xffff top* top* * no start yes cnt = = 0 rep0 = = 0 yes cnt = cnt - 1 cnt = top* * if (buftop) comp0 = comp1 rep 0 = rep1 rep 1 used = 1 cnt = top* no no yes rep1 = = 0 no yes no 23.3.3.2.4 double mode the double repeat mode works much like the one-shot repeat mode. the difference is that, where the one-shot mode counts as long as letimern_rep0 is larger than 0, the double mode counts as long as either letimern_rep0 or letimern_rep1 is larger than 0. as an example, say letimern_rep0 is 3 and letimern_rep1 is 10 when the timer is started. if no further interaction is done with the timer, letimern_rep0 will now be decremented 3 times, and letimern_rep1 will be decremented 10 times. the timer counts a total of 10 times, and letimern_rep0 is 0 after the first three timer underflows and stays at 0. letimern_rep0 and letimern_rep1 can be written at any time. after a write to either of these, the timer is guaranteed to underflow at least the written number of times if the timer is running. use the double repeat mode to generate output on both the letimer outputs at the same time. the state machine for this repeat mode can be seen in figure 23.5 (p. 585 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 585 www.energymicro.com figure 23.5. letimer double repeat state machine running yes cnt = = 0 cnt = cnt - 1 no rep0 < 2 and rep 1 < 2 yes no stop = 1 rep 0 = 0 cnt = top* if (rep0 > 0) rep0 = rep0 - 1 if (rep1 > 0) rep1 = rep1 - 1 if (stop) running = 0 else if (start) running = 1 end if start = 0 stop = 0 wait for posit ive clock edge yes if (comp0top) top* = comp0 else top* = 0xffff top* no start yes cnt = = 0 rep0 = = 0 and rep 1 = = 0 yes cnt = cnt - 1 cnt = top* no no yes no 23.3.3.3 clock source the letimer clock source and its prescaler value are defined in the clock management unit (cmu). the lfaclk letimern has a frequency given by equation 23.1 (p. 585 ) . letimer clock frequency f lfackl_letimern = 32.768/2 letimern (23.1) where the exponent letimern is a 4 bit value in the cmu_lfapresc0 register. to use this module, the le interface clock must be enabled in cmu_hfcoreclken0, in addition to the module clock. 23.3.3.4 rtc trigger the letimer can be configured to start on compare match events from the real time counter (rtc). if rtcc0ten in letimern_ctrl is set, the letimer will start on a compare match on rtc compare channel 0. in the same way, rtcc1ten in letimern_ctrl enables the letimer to start on a compare match with rtc compare channel 1. note the letimer can only use compare match events from the rtc if the letimer runs at a higher than or equal frequency than the rtc. also, if the letimer runs at twice the frequency of the rtc, a compare match event in the rtc will trigger the letimer twice. four times the frequency gives four consecutive triggers, etc. the letimer will only continue running if triggered while it is running, so the multiple-triggering will only have an effect if you try to disable the rtc when it is being triggered.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 586 www.energymicro.com 23.3.3.5 debug if debugrun in letimern_ctrl is cleared, the letimer automatically stops counting when the cpu is halted during a debug session, and resumes operation when the cpu continues. because of synchronization, the letimer is halted two clock cycles after the cpu is halted, and continues running two clock cycles after the cpu continues. running in letimern_status is not cleared when the letimer stops because of a debug-session. set debugrun in letimern_ctrl to allow the letimer to continue counting even when the cpu is halted in debug mode. 23.3.4 underflow output action for each of the repeat registers, an underflow output action can be set. the configured output action is performed every time the counter underflows while the respective repeat register is nonzero. in pwm mode, the output is similarly only changed on comp1 match if the repeat register is nonzero. as an example, the timer will perform 7 output actions if letimern_rep0 is set to 7 when starting the timer in one-shot mode and leaving it untouched for a while. the output actions can be set by configuring ufoa0 and ufoa1 in letimern_ctrl. ufoa0 defines the action on output 0, and is connected to letimern_rep0, while ufoa1 defines the action on output 1 and is connected to letimern_rep1. the possible actions are defined in table 23.2 (p. 586 ) . table 23.2. letimer underflow output actions uf0a0/uf0a1 mode description 00 idle the output is held at its idle value 01 toggle the output is toggled on letimern_cnt underflow if leimern_repx is nonzero 10 pulse the output is held active for one clock cycle on letimern_cnt underflow if letimern_repx is nonzero. it then returns to its idle value 11 pwm the output is set idle on letimern_cnt underflow and active on compare match with letimern_comp1 if letimern_repx is nonzero. note for the pulse and pwm modes, the outputs will return to their idle states regardless of the state of the corresponding letimern_repx registers. they will only be set active if the letimern_repx registers are nonzero however. the polarity of the outputs can be set individually by configuring opol0 and opol1 in letimern_ctrl. when these are cleared, their respective outputs have a low idle value and a high active value. when they are set, the idle value is high, and the active value is low. when using the toggle action, the outputs can be driven to their idle values by setting their respective cto0/cto1 command bits in letimern_ctrl. this can be used to put the output in a well-defined state before beginning to generate toggle output, which may be important in some applications. the command bit can also be used while the timer is running. some simple waveforms generated with the different output modes are shown in figure 23.6 (p. 587 ) . for the example, repmode in letimern_ctrl has been cleared, comp0top also in letimern_ctrl has been set and letimern_comp0 has been written to 3. as seen in the figure, letimern_comp0 now decides the length of the signal periods. for the toggle mode, the period of the output signal is 2(letimern_comp0 + 1), and for the pulse modes, the periods of the output signals
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 587 www.energymicro.com are letimern_comp0+1. note that the pulse outputs are delayed by one period relative to the toggle output. the pulses come at the end of their periods. figure 23.6. letimer simple waveforms output cnt comp0 3 3 3 2 3 1 3 0 3 3 3 2 3 1 3 0 3 3 3 2 3 1 3 0 3 3 3 2 3 1 3 0 3 3 3 2 3 1 3 0 3 3 3 2 3 1 init ial configurat ion ufif ufif ufif ufif ufif int . flags set lfaclk letimern letn_o0 ufoa 0 = 01 letn_o0 ufoa 0 = 10 letn_o0 ufoa 0 = 00 3 0 ufif 3 0 for the example in figure 23.7 (p. 587 ) , the one-shot repeat mode has been selected, and letimern_rep0 has been written to 3. the resulting behavior is pretty similar to that shown in figure 6, but in this case, the timer stops after counting to zero letimern_rep0 times. by using letimern_rep0 the user has full control of the number of pulses/toggles generated on the output. figure 23.7. letimer repeated counting cnt comp0 3 3 3 2 3 1 3 0 3 3 3 2 3 1 3 0 3 3 3 2 3 1 3 0 init ial configurat ion ufif ufif ufif int . flags set lfaclk letimern letn_o0 ufoa 0 = 01 letn_o0 ufoa 0 = 10 letn_o0 ufoa 0 = 00 rep0 3 3 3 3 2 2 2 2 1 1 1 1 st op rep0if 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 3 using the double repeat mode, output can be generated on both the letimer outputs. figure 23.8 (p. 587 ) shows an example of this. ufoa0 and ufoa1 in letimern_ctrl are configured for pulse output and the outputs are configured for low idle polarity. as seen in the figure, the number written to the repeat registers determine the number of pulses generated on each of the outputs. figure 23.8. letimer dual output letn_o0 letn_o1 ufoa0 = 10 ufoa 1 = 10 rep 0 = 2 rep 1 = 7 start rep0 = 3 start rep0 = 2 rep 1 = 3 start
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 588 www.energymicro.com 23.3.5 examples this section presents a couple of usage examples for the letimer. 23.3.5.1 triggered output generation example 23.1. letimer triggered output generation if both letimern_cnt and letimern_rep0 are 0 in buffered mode, and comp0top and buftop in letimern_ctrl are set, the values of letimern_comp1 and letimern_rep1 are loaded into letimern_cnt and letimern_rep0 respectively when the timer is started. if no additional writes to letimern_rep1 are done before the timer stops, letimern_rep1 determines the number of pulses/ toggles generated on the output, and letimern_comp1 determines the period lengths. as the rtc can be used to start the letimer, the rtc and letimer can thus be combined to generate specific pulse-trains at given intervals. software can update letimern_comp1 and letimern_rep1 to change the number of pulses and pulse-period in each train, but if changes are not required, software does not have to update the registers between each pulse train. for the example in figure 23.9 (p. 588 ) , the initial values cause the letimer to generate two pulses with 3 cycle periods, or a single pulse 3 cycles wide every time the letimer is started. after the output has been generated, the letimer stops, and is ready to be triggered again. figure 23.9. letimer triggered operation cnt top0 top1 rep0 rep1 2 x 0 0 2 2 2 2 2 2 2 1 2 2 2 0 2 2 2 2 1 2 2 1 1 2 2 0 1 2 2 2 2 2 2 1 2 2 2 0 2 2 2 2 1 2 2 1 1 2 2 0 1 init ial configurat ion, rep 1 just writ t en ufif rep0if ufif ufif ufif rep0if int . flags set lfaclk letimern 2 u 2 u 2 u st op writ e start = 1 2 2 0 0 2 u st op 2 2 2 2 2 2 1 2 2 2 0 2 ufif writ e start = 1 2 2 0 0 2 u letn_o0 ufoa 0 = 01 letn_o1 ufoa 0 = 10 2 u 2 u 2 u 2 u 2 u 2 u 2 u 2 u 2 u 2 u 2 u 2 u 2 2 0 0 2 u 2 2 0 0 2 u 2 2 0 0 2 u 2 2 0 0 2 u 2 2 0 0 2 u 2 2 0 0 2 u
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 589 www.energymicro.com 23.3.5.2 continuous output generation example 23.2. letimer continuous output generation in some scenarios, it might be desired to make letimer generate a continuous waveform. very simple constant waveforms can be generated without the repeat counter as shown in figure 23.6 (p. 587 ) , but to generate changing waveforms, using the repeat counter and buffer registers can prove advantageous. for the example in figure 23.10 (p. 589 ) , the goal is to produce a pulse train consisting of 3 sequences with the following properties: ? 3 pulses with periods of 3 cycles ? 4 pulses with periods of 2 cycles ? 2 pulses with periods of 3 cycles figure 23.10. letimer continuous operation cnt comp0 comp1 rep0 rep1 1 2 0 3 1 2 2 3 1 2 1 3 1 2 0 3 1 2 2 2 1 2 1 2 1 2 0 2 1 2 2 1 1 2 1 1 1 2 0 1 1 1 1 4 1 1 0 4 1 1 1 3 2 1 0 3 2 1 1 2 2 1 0 2 2 1 1 1 2 1 0 1 2 2 2 2 2 2 1 2 2 2 0 2 2 2 2 1 init ial configurat ion, repb just writ t en ufif rep0if ufif ufif ufif ufif int . flags set st op, final values writ e comp 1 = 2 rep 1 = 2 ufif ufif ufif rep0if 4 4 4 4 4 u 4 u 4 u 2 2 2 u 2 u 2 u 2 u 2 2 1 1 2 2 0 1 2 u 2 u rep0if lfaclk letimern letn_o0 ufoa 0 = 01 letn_o1 ufoa 0 = 10 pulse seq. 1 pulse seq. 2 pulse seq. 3 4 4 4 4 4 4 2 2 2 2 2 0 0 2 u the first two sequences are loaded into the letimer before the timer is started. letimern_comp0 is set to 2 (cycles ? 1), and letimern_rep0 is set to 3 for the first sequence, and the second sequence is loaded into the buffer registers, i.e. comp1 is set to 1 and letimern_rep1 is set to 4. the letimer is set to trigger an interrupt when letimern_rep0 is done by setting rep0 in letimern_ien. this interrupt is a good place to update the values of the buffers. last but not least repmode in letimern_ctrl is set to buffered mode, and the timer is started. in the interrupt routine the buffers are updated with the values for the third sequence. if this had not been done, the timer would have stopped after the second sequence. the final result is shown in figure 23.10 (p. 589 ) . the pulse output is grouped to show which sequence generated which output. toggle output is also shown in the figure. note that the toggle output is not aligned with the pulse outputs. note
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 590 www.energymicro.com multiple letimer cycles are required to write a value to the letimer registers. the example in figure 23.10 (p. 589 ) assumes that writes are done in advance so they arrive in the letimer as described in the figure. figure 23.11 (p. 590 ) shows an example where the letimer is started while letimern_cnt is nonzero. in this case the length of the first repetition is given by the value in letimern_cnt. figure 23.11. letimer letimern_cnt not initialized to 0 cnt top0 top1 rep0 rep1 3 2 4 3 3 3 2 3 3 3 2 2 3 3 2 1 3 3 2 0 3 3 2 2 2 3 2 1 2 3 2 0 2 3 2 2 1 3 2 1 1 3 2 0 1 3 3 3 3 3 3 2 3 3 3 1 3 3 3 0 3 3 3 3 2 3 3 2 2 3 3 1 2 3 3 0 2 3 3 3 1 3 3 2 1 3 3 1 1 3 3 0 init ial configurat ion, rep 1 just writ t en ufif rep0if ufif ufif ufif ufif ufif rep0if int . flags set st op, final values lfaclk letimern letn_o0 ufoa 0 = 01 letn_o1 ufoa 0 = 10 3 3 3 3 3 3 3 3 u 3 u 3 u 3 u 3 u 3 u 3 u 3 3 3 3 u 3 u 3 u 1 3 u 3 u 3 3 0 0 3 u 23.3.5.3 pwm output example 23.3. letimer pwm output there are several ways of generating pwm output with the letimer, but the most straight-forward way is using the pwm output mode. this mode is enabled by setting ufoa0 or ofua1 in letimern_ctrl to 3. in pwm mode, the output is set idle on timer underflow, and active on letimern_comp1 match, so if for instance comp0top = 1 and opol0 = 0 in letimern_ctrl, letimern_comp0 determines the pwm period, and letimern_letimern_comp1 determines the active period. the pwm period in pwm mode is letimern_comp0 + 1. there is no special handling of the case where letimern_comp1 > letimern_comp0, so if letimern_comp1 > letimern_comp0, the pwm output is given by the idle output value. this means that for opolx = 0 in letimern_ctrl, the pwm output will always be 0 for at least one clock cycle, and for opolx = 1 letimern_ctrl, the pwm output will always be 1 for at least one clock cycle. to generate a pwm signal using the full pwm range, invert opolx when letimern_comp1 is set to a value larger than letimern_comp0. 23.3.5.4 interrupts example 23.4. letimer pwm output the interrupts generated by the letimer are combined into one interrupt vector. if the interrupt for the letimer is enabled, an interrupt will be made if one or more of the interrupt flags in letimern_if and their corresponding bits in letimer_ien are set.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 591 www.energymicro.com 23.3.6 register access his module is a low energy peripheral, and supports immediate synchronization. for description regarding immediate synchronization, the reader is referred to section 5.3.1.1 (p. 22 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 592 www.energymicro.com 23.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 letimern_ctrl rw control register 0x004 letimern_cmd w1 command register 0x008 letimern_status r status register 0x00c letimern_cnt rwh counter value register 0x010 letimern_comp0 rw compare value register 0 0x014 letimern_comp1 rw compare value register 1 0x018 letimern_rep0 rw repeat counter register 0 0x01c letimern_rep1 rw repeat counter register 1 0x020 letimern_if r interrupt flag register 0x024 letimern_ifs w1 interrupt flag set register 0x028 letimern_ifc w1 interrupt flag clear register 0x02c letimern_ien rw interrupt enable register 0x030 letimern_freeze rw freeze register 0x034 letimern_syncbusy r synchronization busy register 0x040 letimern_route rw i/o routing register 23.5 register description 23.5.1 letimern_ctrl - control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw rw rw name debugrun rtcc1ten rtcc0ten comp0top buftop opol1 opol0 ufoa1 ufoa0 repmode bit name reset access description 31:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 debugrun 0 rw debug mode run enable set to keep the letimer running in debug mode. value description 0 letimer is frozen in debug mode 1 letimer is running in debug mode 11 rtcc1ten 0 rw rtc compare 1 trigger enable allows the letimer to be started on a compare match on rtc compare channel 1. value description 0 letimer is not affected by rtc compare channel 1
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 593 www.energymicro.com bit name reset access description value description 1 a compare match on rtc compare channel 1 starts the letimer if the letimer is not already started 10 rtcc0ten 0 rw rtc compare 0 trigger enable allows the letimer to be started on a compare match on rtc compare channel 0. value description 0 letimer is not affected by rtc compare channel 0 1 a compare match on rtc compare channel 0 starts the letimer if the letimer is not already started 9 comp0top 0 rw compare value 0 is top value when set, the counter is cleared in the clock cycle after a compare match with compare channel 0. value description 0 the top value of the letimer is 65535 (0xffff) 1 the top value of the letimer is given by comp0 8 buftop 0 rw buffered top set to load comp1 into comp0 when rep0 reaches 0, allowing a buffered top value value description 0 comp0 is only written by software 1 comp0 is set to comp1 when rep0 reaches 0 7 opol1 0 rw output 1 polarity defines the idle value of output 1. 6 opol0 0 rw output 0 polarity defines the idle value of output 0. 5:4 ufoa1 0x0 rw underflow output action 1 defines the action on letn_o1 on a letimer underflow. value mode description 0 none letn_o1 is held at its idle value as defined by opol1. 1 toggle letn_o1 is toggled on cnt underflow. 2 pulse letn_o1 is held active for one lfaclk letimer0 clock cycle on cnt underflow. the output then returns to its idle value as defined by opol1. 3 pwm letn_o1 is set idle on cnt underflow, and active on compare match with comp1 3:2 ufoa0 0x0 rw underflow output action 0 defines the action on letn_o0 on a letimer underflow. value mode description 0 none letn_o0 is held at its idle value as defined by opol0. 1 toggle letn_o0 is toggled on cnt underflow. 2 pulse letn_o0 is held active for one lfaclk letimer0 clock cycle on cnt underflow. the output then returns to its idle value as defined by opol0. 3 pwm letn_o0 is set idle on cnt underflow, and active on compare match with comp1 1:0 repmode 0x0 rw repeat mode allows the repeat counter to be enabled and disabled. value mode description 0 free when started, the letimer counts down until it is stopped by software. 1 oneshot the counter counts rep0 times. when rep0 reaches zero, the counter stops. 2 buffered the counter counts rep0 times. if rep1 has been written, it is loaded into rep0 when rep0 reaches zero. else the counter stops 3 double both rep0 and rep1 are decremented when the letimer wraps around. the letimer counts until both rep0 and rep1 are zero
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 594 www.energymicro.com 23.5.2 letimern_cmd - command register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 access w1 w1 w1 w1 w1 name cto1 cto0 clear stop start bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 cto1 0 w1 clear toggle output 1 set to drive toggle output 1 to its idle value 3 cto0 0 w1 clear toggle output 0 set to drive toggle output 0 to its idle value 2 clear 0 w1 clear letimer set to clear letimer 1 stop 0 w1 stop letimer set to stop letimer 0 start 0 w1 start letimer set to start letimer 23.5.3 letimern_status - status register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access r name running bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 running 0 r letimer running set when letimer is running.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 595 www.energymicro.com 23.5.4 letimern_cnt - counter value register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rwh name cnt bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 cnt 0x0000 rwh counter value use to read the current value of the letimer. 23.5.5 letimern_comp0 - compare value register 0 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name comp0 bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 comp0 0x0000 rw compare value 0 compare and optionally top value for letimer 23.5.6 letimern_comp1 - compare value register 1 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 596 www.energymicro.com offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name comp1 bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 comp1 0x0000 rw compare value 1 compare and optionally buffered top value for letimer 23.5.7 letimern_rep0 - repeat counter register 0 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name rep0 bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 rep0 0x00 rw repeat counter 0 optional repeat counter. 23.5.8 letimern_rep1 - repeat counter register 1 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name rep1 bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 597 www.energymicro.com bit name reset access description 7:0 rep1 0x00 rw repeat counter 1 optional repeat counter or buffer for rep0 23.5.9 letimern_if - interrupt flag register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 access r r r r r name rep1 rep0 uf comp1 comp0 bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 rep1 0 r repeat counter 1 interrupt flag set when repeat counter 1 reaches zero. 3 rep0 0 r repeat counter 0 interrupt flag set when repeat counter 0 reaches zero or when the rep1 interrupt flag is loaded into the rep0 interrupt flag. 2 uf 0 r underflow interrupt flag set on letimer underflow. 1 comp1 0 r compare match 1 interrupt flag set when letimer reaches the value of comp1 0 comp0 0 r compare match 0 interrupt flag set when letimer reaches the value of comp0 23.5.10 letimern_ifs - interrupt flag set register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 access w1 w1 w1 w1 w1 name rep1 rep0 uf comp1 comp0 bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 rep1 0 w1 set repeat counter 1 interrupt flag write to 1 to set the rep1 interrupt flag. 3 rep0 0 w1 set repeat counter 0 interrupt flag write to 1 to set the rep0 interrupt flag. 2 uf 0 w1 set underflow interrupt flag write to 1 to set the uf interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 598 www.energymicro.com bit name reset access description 1 comp1 0 w1 set compare match 1 interrupt flag write to 1 to set the comp1 interrupt flag. 0 comp0 0 w1 set compare match 0 interrupt flag write to 1 to set the comp0 interrupt flag. 23.5.11 letimern_ifc - interrupt flag clear register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 access w1 w1 w1 w1 w1 name rep1 rep0 uf comp1 comp0 bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 rep1 0 w1 clear repeat counter 1 interrupt flag write to 1 to clear the rep1 interrupt flag. 3 rep0 0 w1 clear repeat counter 0 interrupt flag write to 1 to clear the rep0 interrupt flag. 2 uf 0 w1 clear underflow interrupt flag write to 1 to clear the uf interrupt flag. 1 comp1 0 w1 clear compare match 1 interrupt flag write to 1 to clear the comp1 interrupt flag. 0 comp0 0 w1 clear compare match 0 interrupt flag write to 1 to clear the comp0 interrupt flag. 23.5.12 letimern_ien - interrupt enable register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 access rw rw rw rw rw name rep1 rep0 uf comp1 comp0 bit name reset access description 31:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 rep1 0 rw repeat counter 1 interrupt enable set to enable interrupt on the rep1 interrupt flag. 3 rep0 0 rw repeat counter 0 interrupt enable set to enable interrupt on the rep0 interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 599 www.energymicro.com bit name reset access description 2 uf 0 rw underflow interrupt enable set to enable interrupt on the uf interrupt flag. 1 comp1 0 rw compare match 1 interrupt enable set to enable interrupt on the comp1 interrupt flag. 0 comp0 0 rw compare match 0 interrupt enable set to enable interrupt on the comp0 interrupt flag. 23.5.13 letimern_freeze - freeze register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name regfreeze bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 regfreeze 0 rw register update freeze with the immediate write synchronization scheme the regfreeze register is no longer used. value mode description 0 update each write access to a letimer register is updated into the low frequency domain as soon as possible. 1 freeze the letimer is not updated with the new written value. 23.5.14 letimern_syncbusy - synchronization busy register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access r r r r r r name rep1 rep0 comp1 comp0 cmd ctrl bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 rep1 0 r rep1 register busy set when the value written to rep1 is being synchronized. 4 rep0 0 r rep0 register busy set when the value written to rep0 is being synchronized. 3 comp1 0 r comp1 register busy set when the value written to comp1 is being synchronized. 2 comp0 0 r comp0 register busy
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 600 www.energymicro.com bit name reset access description set when the value written to comp0 is being synchronized. 1 cmd 0 r cmd register busy set when the value written to cmd is being synchronized. 0 ctrl 0 r ctrl register busy set when the value written to ctrl is being synchronized. 23.5.15 letimern_route - i/o routing register offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 access rw rw rw name location out1pen out0pen bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 location 0x0 rw i/o location decides the location of the letimer i/o pins value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 3 loc3 location 3 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 out1pen 0 rw output 1 pin enable when set, output 1 of the letimer is enabled value description 0 the letn_o1 pin is disabled 1 the letn_o1 pin is enabled 0 out0pen 0 rw output 0 pin enable when set, output 0 of the letimer is enabled value description 0 the letn_o0 pin is disabled 1 the letn_o0 pin is enabled
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 601 www.energymicro.com 24 pcnt - pulse counter 0 1 2 3 4 reload value int errupt quadrat ure code 0 quick facts what? the pulse counter (pcnt) decodes incoming pulses. the module has a quadrature mode which may be used to decode the speed and direction of a mechanical shaft. pcnt can operate in em0- em3. why? the pcnt generates an interrupt after a specific number of pulses (or rotations), eliminating the need for timing- or i/o interrupts and cpu processing to measure pulse widths, etc. how? pcnt uses the lfaclk or may be externally clocked from a pin. the module incorporates an 8/16-bit up/down-counter to keep track of incoming pulses or rotations. 24.1 introduction the pulse counter (pcnt) can be used for counting incoming pulses on a single input or to decode quadrature encoded inputs. it can run from the internal lfaclk (em0-em2) while counting pulses on the pcntn_s0in pin or using this pin as an external clock source (em0-em3) that runs both the pcnt counter and register access. 24.2 features ? 16/8-bit counter with reload register ? auxiliary counter for counting a single direction ? single input oversampling up/down counter mode (em0-em2) ? externally clocked single input pulse up/down counter mode (em0-em3) ? externally clocked quadrature decoder mode (em0-em3) ? interrupt on counter underflow and overflow ? interrupt when a direction change is detected (quadrature decoder mode only) ? optional pulse width filter ? optional input inversion/edge detect select ? prs s0in and s1in input 24.3 functional description an overview of the pcnt module is shown in figure 24.1 (p. 602 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 602 www.energymicro.com figure 24.1. pcnt overview peripheral bus cnt pcntn_s0in pulse widt h filt er invert er pcntn_s1in invert er count enable 1 lfaclk clock swit ch cmu (consept ual) topb quadrat ure decoder edge det ect or ovr_single extclk_single extclk_quad top s0prs input analog de-glit ch filt er s1prs input clk pcnt 24.3.1 pulse counter modes the pulse counter can operate in single input oversampling mode (ovssingle), externally clocked single input counter mode (extclksingle) and externally clocked quadrature decoder mode (extclkquad). the following sections describe operation of each of the three modes and how they are enabled. input timing constraints are described in section 24.3.5 (p. 605 ) and section 24.3.6 (p. 605 ) . 24.3.1.1 single input oversampling mode this mode is enabled by writing ovssingle to the mode field in the pcntn_ctrl register and disabled by writing disable to the same field. lfaclk is configured from the registers in the clock management unit (cmu), chapter 11 (p. 124 ) . the optional pulse width filter is enabled by setting the filt bit in the pcntn_ctrl register. additionally, the pcntn_s0in input may be inverted, so that falling edges are counted, by setting the edge bit in the pcntn_ctrl register. if s1cdir is cleared, pcntn_s0in is the only observed input in this mode. the pcntn_s0in input is sampled by the lfaclk and the number of detected positive or negative edges on pcntn_s0in appears in pcntn_cnt. the counter may be configured to count down by setting the cntdir bit in pcntn_ctrl. default is to count up. the counting direction can also be controlled externally in this mode by setting s1cdir in pcntn_ctrl. this will make the input value on pcntn_s1in decide the direction counted on a pcntn_s0in edge. if pcntn_s1in is high, the count is done according to cntdir in pcntn_ctrl. if low, the count direction is opposite. 24.3.1.2 externally clocked single input counter mode this mode is enabled by writing extclksingle to the mode field in the pcntn_ctrl register and disabled by writing disable to the same field. the external pin clock source must be configured from the registers in the cmu ( chapter 11 (p. 124 ) ). positive edges on pcntn_s0in are used to clock the counter. similar to the oversampled mode, pcntn_s1in is used to determine the count direction if s1cdir in pcntn_ctrl is set. if not, cntdir in pcntn_ctrl solely defines count direction. as the lfaclk is not used in this mode, the pcnt module can operate in em3.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 603 www.energymicro.com the digital pulse width filter is not available in this mode. the analog de-glitch filter in the gpio pads is capable of removing some unwanted noise. however, this mode may be susceptible to spikes and unintended pulses from devices such as mechanical switches, and is therefore most suited to take input from electronic sensors etc. that generate single wire pulses. 24.3.1.3 externally clocked quadrature decoder mode this mode is enabled by writing extclkquad to the mode field in pcntn_ctrl and disabled by writing disable to the same field. the external pin clock source must be configured from the registers in the cmu, ( chapter 11 (p. 124 ) ). both edges on pcntn_s0in pin are used to sample pcntn_s1in pin to decode the quadrature code. consequently, this mode does not depend on the internal lfaclk and may be operated in em3. a quadrature coded signal contains information about the relative speed and direction of a rotating shaft as illustrated by figure 24.2 (p. 603 ) , hence the direction of the counter register pcntn_cnt is controlled automatically. figure 24.2. pcnt quadrature coding x x 1 cycle/sect or, 4 st at es 01 11 10 00 x x 1 cycle/sect or, 4 st at es 00 10 11 01 x = sensor posit ion clockwise direct ion count er clockwise direct ion pcntn_s0in pcntn_s1in pcntn_s0in pcntn_s1in pcntn_cnt reset 0 0 1 2 pcntn_cnt 0 0 pcntn_top pcntn_top-1 if pcntn_s0in leads pcntn_s1in in phase, the direction is clockwise, and if it lags in phase the direction is counter-clockwise. although the direction is automatically detected, the detected direction may be inverted by writing 1 to the edge bit in the pcntn_ctrl register. default behavior is illustrated by figure 24.2 (p. 603 ) . the counter direction may be read from the dir bit in the pcntn_status register. additionally, the dircng interrupt in the pcntn_if register is generated when a direction change is detected. when a change is detected, the dir bit in the pcntn_status register must be read to determine the current new direction. note the sector disc illustrated in the figure may be finer grained in some systems. typically, they may generate 2-4 pcntn_s0in wave periods per 360 rotation.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 604 www.energymicro.com the direction of the quadrature code and control of the counter is generated by the simple binary function outlined by table 24.1 (p. 604 ) . note that this function also filters some invalid inputs that may occur when the shaft changes direction or temporarily toggles direction. table 24.1. pcnt quad mode counter control function inputs control/status s1in posedge s1in negedge count enable cntdir status bit 0 0 0 0 0 1 1 0 1 0 1 1 1 1 0 0 note pcntn_s1in is sampled on both edges of pcntn_s0in. 24.3.2 hysteresis by default the pulse counter wraps to 0 when passing the configured top value, and wraps to the top value when counting down from 0. on these events, a system will likely want to wake up to store and track the overflow count. this is fine if the pulse counter is tracking a monotonic value or a value that does not change directions frequently. if you have the latter however, and the counter changes directions around the overflow/underflow point, the system will have to wake up a lot to keep track of the rotations, causing high current consumptions to solve this, the pulse counter has a way of introducing hysteresis to the counter. when hyst in pcntn_ctrl is set, the pulse counter will always wrap to top/2 on underflows and overflows. this takes the counter away from the area where it might overflow or underflow, removing the problem. given a starting value of 0 for the counter, the absolute count value when hysteresis is enabled can be calculated with the equations equation 24.1 (p. 604 ) or equation 24.2 (p. 604 ) , depending on whether the top value is even or odd. absolute position with hysteresis and even top value cnt abs = cnt - uf cnt x (top/2+1) + of cnt x (top/2+1) (24.1) absolute position with hysteresis and odd top value cnt abs = cnt - uf cnt x (top/2+1) + of cnt x (top/2+2) (24.2) 24.3.3 auxiliary counter to be able to keep explicit track of counting in one direction in addition to the regular counter which counts both up and down, the auxiliary counter can be used. the pulse counter can for instance be configured to keep track of the absolute rotation of the wheel, and at the same time the auxiliary counter can keep track of how much the wheel has reversed. the auxiliary counter is enabled by configuring auxcntev in pcntn_ctrl. it will always count up, but it can be configured whether it should count up on up-events, down-events or both, keeping track of rotation either way or general movement. the value of the auxiliary counter can be read from the pcntn_auxcnt register. overflows on the auxiliary counter happen when the auxiliary counter passes the top value of the pulse counter, configured in pcntn_top. in that event, the auxof interrupt flag is set, and the auxiliary counter wraps to 0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 605 www.energymicro.com as the auxiliary counter, the main counter can be configured to count only on certain events. this is done through cntev in pcntn_ctrl, and it is possible like for the auxiliary counter, to make the main counter count on only up and down events. the difference between the counters is that where the auxiliary counter will only count up, the main counter will count up or down depending on the direction of the count event. 24.3.4 register access the counter-clock domain may be clocked externally. to update the counter-clock domain registers from software in this mode, 2-3 clock pulses on the external clock are needed to synchronize accesses to the externally clocked domain. clock source switching is controlled from the registers in the cmu ( chapter 11 (p. 124 ) ). when the rsten bit in the pcntn_ctrl register is set to 1, the pcnt clock domain is asynchronously held in reset. the reset is synchronously released two pcnt clock edges after the rsten bit in the pcntn_ctrl register is cleared by software. this asynchronous reset restores the reset values in pcntn_top, pcntn_cnt and other control registers in the pcnt clock domain. since this module is a low energy peripheral, and runs off a clock which is asynchronous to the hfcoreclk, special considerations must be taken when accessing registers. please refer to section 5.3 (p. 21 ) for a description on how to perform register accesses to low energy peripherals. note pcntn_top and pcntn_cnt are read-only registers. when writing to pcntn_topb, make sure that the counter value, pcntn_cnt, can not exceed the value written to pcntn_topb within two clock cycles. 24.3.5 clock sources the 32 khz lfaclk is one of two possible clock sources. the clock select register is described in chapter 11 (p. 124 ) . the default clock source is the lfaclk. this pcnt module may also use pcntn_s0in as an external clock to clock the counter (extclksingle mode) and to sample pcntn_s1in (extclkquad mode). setup, hold and max frequency constraints for pcntn_s0in and pcntn_s1in for these modes are specified in the device datasheet. to use this module, the le interface clock must be enabled in cmu_hfcoreclken0, in addition to the module clock. note pcnt clock domain reset, rsten, should be set when changing clock source for pcnt. if changing to an external clock source, the clock pin has to be enabled as input prior to de- asserting rsten. changing clock source without asserting rsten results in undefined behaviour. 24.3.6 input filter an optional pulse width filter is available in ovssingle mode. the filter is enabled by writing 1 to the filt bit in the pcntn_ctrl register. when enabled, the high and low periods of pcntn_s0in must be stable for 5 consecutive clock cycles before the edge is passed to the edge detector. in extclksingle and extclkquad mode, there is no digital pulse width filter available. 24.3.7 edge polarity the edge polarity can be set by configuring the edge bit in the pcntn_ctrl register. when this bit is cleared, the pulse counter counts positive edges in ovssingle mode and negative edges if the bit is set.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 606 www.energymicro.com in extclkquad mode, the edge bit in pcntn_ctrl inverts the direction of the counter (which is automatically detected). note the edge bit in pcntn_ctrl has no effect in extclksingle mode. 24.3.8 prs s0in and s1in input it is possible to receive input from prs on both soin and s1in by setting s0prsen or s1prsen in pcntn_input. the prs channel used can be selected using s0prssel in pcntn_input. 24.3.9 interrupts the interrupt generated by pcnt uses the pcntn_int interrupt vector. software must read the pcntn_if register to determine which module interrupt that generated the vector invocation. 24.3.9.1 underflow and overflow interrupts the underflow interrupt flag (uf) is set when the counter counts down from 0. i.e. when the value of the counter is 0 and a new pulse is received. the pcntn_cnt register is loaded with the pcntn_top value after this event. the overflow interrupt flag (of) is set when the counter counts up from the pcntn_top (reload) value. i.e. if pcntn_cnt = pcntn_top and a new pulse is received. the pcntn_cnt register is loaded with the value 0 after this event. 24.3.9.2 direction change interrupt the pcntn_pcnt module sets the dircng interrupt flag (pcntn_if register) when the direction of the quadrature code changes. the behavior of this interrupt is illustrated by figure 24.3 (p. 606 ) . figure 24.3. pcnt direction change interrupt (dircng) generation st andard async handshake int erface pcntn_s0in pcntn_s1in int errupt x x invalid pulse generat ed when t he shaft changes direct ion n+ 1 n+ 2 n+ 3 n+ 2 pcntn_cnt n delay from t he shaft physically changed direct ion unt il t he count er direct ion is changed and t he int errupt is generat ed
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 607 www.energymicro.com 24.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 pcntn_ctrl rw control register 0x004 pcntn_cmd w1 command register 0x008 pcntn_status r status register 0x00c pcntn_cnt r counter value register 0x010 pcntn_top r top value register 0x014 pcntn_topb rw top value buffer register 0x018 pcntn_if r interrupt flag register 0x01c pcntn_ifs w1 interrupt flag set register 0x020 pcntn_ifc w1 interrupt flag clear register 0x024 pcntn_ien rw interrupt enable register 0x028 pcntn_route rw i/o routing register 0x02c pcntn_freeze rw freeze register 0x030 pcntn_syncbusy r synchronization busy register 0x038 pcntn_auxcnt rwh auxiliary counter value register 0x03c pcntn_input rw pcnt input register 24.5 register description 24.5.1 pcntn_ctrl - control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0 0 0 0 0 0 0x0 access rw rw rw rw rw rw rw rw rw name auxcntev cntev s1cdir hyst rsten filt edge cntdir mode bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:14 auxcntev 0x0 rw controls when the auxiliary counter counts selects whether the auxiliary counter responds to up-count events, down-count events or both value mode description 0 none never counts. 1 up counts up on up-count events. 2 down counts up on down-count events. 3 both counts up on both up-count and down-count events. 13:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:10 cntev 0x0 rw controls when the counter counts selects whether the regular counter responds to up-count events, down-count events or both
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 608 www.energymicro.com bit name reset access description value mode description 0 both counts up on up-count and down on down-count events. 1 up only counts up on up-count events. 2 down only counts down on down-count events. 3 none never counts. 9 s1cdir 0 rw count direction determined by s1 s1 gives the direction of counting when in the ovssingle or extclksingle modes. when s1 is high, the count direction is given by cntdir, and when s1 is low, the count direction is the opposite 8 hyst 0 rw enable hysteresis when hysteresis is enabled, the pcnt will always overflow and underflow to top/2. 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 rsten 0 rw enable pcnt clock domain reset the pcnt clock domain is asynchronously held in reset when this bit is set. the reset is synchronously released two pcnt clock edges after this bit is cleared. if external clock used the reset should be performed by setting and clearing the bit without pending for syncbusy bit. 4 filt 0 rw enable digital pulse width filter the filter passes all high and low periods that are at least 5 clock cycles long. this filter is only available in ovssingle mode. 3 edge 0 rw edge select determines the polarity of the incoming edges. this bit should be written when pcnt is in disable mode, otherwise the behavior is unpredictable. this bit is ignored in extclksingle mode. value mode description 0 pos positive edges on the pcntn_s0in inputs are counted in ovssingle mode. 1 neg negative edges on the pcntn_s0in inputs are counted in ovssingle mode, and the counter direction is inverted in extclkquad mode. 2 cntdir 0 rw non-quadrature mode counter direction control the direction of the counter must be set in the ovssingle and extclksingle modes. this bit is ignored in extclkquad mode as the direction is automatically detected. value mode description 0 up up counter mode. 1 down down counter mode. 1:0 mode 0x0 rw mode select selects the mode of operation. the corresponding clock source must be selected from the cmu. value mode description 0 disable the module is disabled. 1 ovssingle single input lfaclk oversampling mode (available in em0-em2). 2 extclksingle externally clocked single input counter mode (available in em0-em3). 3 extclkquad externally clocked quadrature decoder mode (available in em0-em3). 24.5.2 pcntn_cmd - command register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name ltopbim lcntim
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 609 www.energymicro.com bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 ltopbim 0 w1 load topb immediately this bit has no effect since topb is not buffered and it is loaded directly into top. for EFM32WG revisions a and b: load pcntn_topb into pcntn_top. please see the device datasheet for a description on how to extract the chip revision. 0 lcntim 0 w1 load cnt immediately load pcntn_top into pcntn_cnt on the next counter clock cycle. 24.5.3 pcntn_status - status register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access r name dir bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 dir 0 r current counter direction current direction status of the counter. this bit is valid in extclkquad mode only. value mode description 0 up up counter mode (clockwise in extclkquad mode with the nedge bit in pcntn_ctrl set to 0). 1 down down counter mode. 24.5.4 pcntn_cnt - counter value register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access r name cnt bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 cnt 0x0000 r counter value gives read access to the counter.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 610 www.energymicro.com 24.5.5 pcntn_top - top value register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00ff access r name top bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 top 0x00ff r counter top value when counting down, this value is reloaded into pcntn_cnt when counting past 0. when counting up, 0 is written to the pcntn_cnt register when counting past this value. 24.5.6 pcntn_topb - top value buffer register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00ff access rw name topb bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 topb 0x00ff rw counter top buffer loaded automatically to top when written. 24.5.7 pcntn_if - interrupt flag register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access r r r r name auxof dircng of uf
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 611 www.energymicro.com bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 auxof 0 r overflow interrupt read flag set when an auxiliary cnt overflow occurs 2 dircng 0 r direction change detect interrupt flag set when the count direction changes. set in extclkquad mode only. 1 of 0 r overflow interrupt read flag set when a cnt overflow occurs 0 uf 0 r underflow interrupt read flag set when a cnt underflow occurs 24.5.8 pcntn_ifs - interrupt flag set register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name auxof dircng of uf bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 auxof 0 w1 auxiliary overflow interrupt set write to 1 to set the auxiliary overflow interrupt flag 2 dircng 0 w1 direction change detect interrupt set write to 1 to set the direction change interrupt flag 1 of 0 w1 overflow interrupt set write to 1 to set the overflow interrupt flag 0 uf 0 w1 underflow interrupt set write to 1 to set the underflow interrupt flag 24.5.9 pcntn_ifc - interrupt flag clear register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name auxof dircng of uf bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 auxof 0 w1 auxiliary overflow interrupt clear
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 612 www.energymicro.com bit name reset access description write to 1 to clear the auxiliary overflow interrupt flag 2 dircng 0 w1 direction change detect interrupt clear write to 1 to clear the direction change detect interrupt flag 1 of 0 w1 overflow interrupt clear write to 1 to clear the overflow interrupt flag 0 uf 0 w1 underflow interrupt clear write to 1 to clear the underflow interrupt flag 24.5.10 pcntn_ien - interrupt enable register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access rw rw rw rw name auxof dircng of uf bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 auxof 0 rw auxiliary overflow interrupt enable enable the auxiliary overflow interrupt 2 dircng 0 rw direction change detect interrupt enable enable the direction change detect interrupt. 1 of 0 rw overflow interrupt enable enable the overflow interrupt 0 uf 0 rw underflow interrupt enable enable the underflow interrupt 24.5.11 pcntn_route - i/o routing register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 access rw name location bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 location 0x0 rw i/o location defines the location of the pcnt input pins. e.g. pcntn_s0#0, #1 or #2. value mode description 0 loc0 location 0
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 613 www.energymicro.com bit name reset access description value mode description 1 loc1 location 1 2 loc2 location 2 3 loc3 location 3 7:0 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24.5.12 pcntn_freeze - freeze register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name regfreeze bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 regfreeze 0 rw register update freeze when set, the update of the pcnt clock domain is postponed until this bit is cleared. use this bit to update several registers simultaneously. value mode description 0 update each write access to a pcnt register is updated into the low frequency domain as soon as possible. 1 freeze the pcnt clock domain is not updated with the new written value. 24.5.13 pcntn_syncbusy - synchronization busy register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 access r r r name topb cmd ctrl bit name reset access description 31:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 topb 0 r topb register busy set when the value written to topb is being synchronized. 1 cmd 0 r cmd register busy set when the value written to cmd is being synchronized. 0 ctrl 0 r ctrl register busy set when the value written to ctrl is being synchronized.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 614 www.energymicro.com 24.5.14 pcntn_auxcnt - auxiliary counter value register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rwh name auxcnt bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 auxcnt 0x0000 rwh auxiliary counter value gives read access to the auxiliary counter. 24.5.15 pcntn_input - pcnt input register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 0 0x0 access rw rw rw rw name s1prsen s1prssel s0prsen s0prssel bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10 s1prsen 0 rw s1in prs enable when set, the prs channel is selected as input to s1in. 9:6 s1prssel 0x0 rw s1in prs channel select select prs channel as input to s1in. value mode description 0 prsch0 prs channel 0 selected. 1 prsch1 prs channel 1 selected. 2 prsch2 prs channel 2 selected. 3 prsch3 prs channel 3 selected. 4 prsch4 prs channel 4 selected. 5 prsch5 prs channel 5 selected. 6 prsch6 prs channel 6 selected. 7 prsch7 prs channel 7 selected. 8 prsch8 prs channel 8 selected. 9 prsch9 prs channel 9 selected. 10 prsch10 prs channel 10 selected. 11 prsch11 prs channel 11 selected. 5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 615 www.energymicro.com bit name reset access description 4 s0prsen 0 rw s0in prs enable when set, the prs channel is selected as input to s0in. 3:0 s0prssel 0x0 rw s0in prs channel select select prs channel as input to s0in. value mode description 0 prsch0 prs channel 0 selected. 1 prsch1 prs channel 1 selected. 2 prsch2 prs channel 2 selected. 3 prsch3 prs channel 3 selected. 4 prsch4 prs channel 4 selected. 5 prsch5 prs channel 5 selected. 6 prsch6 prs channel 6 selected. 7 prsch7 prs channel 7 selected. 8 prsch8 prs channel 8 selected. 9 prsch9 prs channel 9 selected. 10 prsch10 prs channel 10 selected. 11 prsch11 prs channel 11 selected.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 616 www.energymicro.com 25 lesense - low energy sensor interface 0 1 2 3 4 efm32 z z z z z quick facts what? lesense is a low energy sensor interface capable of autonomously collecting and processing data from multiple sensors even when in em2. flexible configuration makes lesense a versatile sensor interface compatible with a wide range of sensors and measurement schemes. why? capability to autonomously monitor sensors allows the EFM32WG to reside in a low energy mode for long periods of time while keeping track of sensor status and sensor events. how? lesense is highly configurable and is capable of collecting data from a wide range of sensor types. once the data is collected, the programmable state machine, lesense decoder, is capable of processing sensor data without cpu intervention. a large result buffer allows the chip to remain in em2 for long periods of time while autonomously collecting data. 25.1 introduction lesense is a low energy sensor interface which utilizes on-chip peripherals to perform measurement of a configurable set of sensors. the results from sensor measurements can be processed by the lesense decoder, which is a configurable state machine with up to 16 states. the results can also be stored in a result buffer to be collected by cpu or dma for further processing. lesense operates in em2, in addition to em1 and em0, and can wake up the cpu on configurable events. 25.2 features ? up to 16 sensors ? autonomous sensor monitoring in em0, em1, and em2 ? highly configurable decoding of sensor results ? interrupt on sensor events ? configurable enable signals to external sensors ? circular buffer for storage of up to 16 sensor results. ? support for multiple sensor types ? lc sensors ? capacitive sensing ? general analog sensors
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 617 www.energymicro.com 25.3 functional description lesense is a module capable of controlling on-chip peripherals in order to perform monitoring of different sensors with little or no cpu intervention. lesense uses the analog comparators, acmp, for measurement of sensor signals. lesense can also control the dac to generate accurate reference voltages. figure 25.1 (p. 617 ) shows an overview of the lesense module. lesense consists of a sequencer, count and compare block, a decoder, and a ram block used for configuration and result storage. the sequencer handles interaction with other peripherals as well as timing of sensor measurements. the count and compare block is used to count pulses from acmp outputs before comparing with a configurable threshold. to autonomously analyze sensor results, the lesense decoder provides possibility to define a finite state machine with up to 16 states, and programmable actions upon state transitions. this allows the decoder to implement a wide range of decoding schemes, for instance quadrature decoding. a ram block is used for storage of configuration and measurement results. this allows lesense to have a relatively large result buffer enabling the chip to remain in a low energy mode for long periods of time while collecting sensor data. figure 25.1. lesense block diagram lesense count er com pare decoder prs input dac0 auxhfrco acmp1 acmp1_chn les_altexn regist er bit fields overridden by lesense scaler 1.25 v 2.5 v v dd v ss acmp0 acmp0_chn prs ch0 ch1 dac0_ch0 dac0_ch1 dac0_ch0 dac0_ch1 dac0_ch0 dac0_ch1 scaler 1.25 v 2.5 v v dd v ss dac0_ch0 dac0_ch1 acmp0inv acmp1inv vddlevel possel possel vddlevel ram sequencer acmp sam ple reg convmode* outmode* chxctrl_en chxdata dac int erface * lesense cont rols convmode and outmode individually for t he dac channels 25.3.1 channel configuration lesense has 16 individually configurable channels, the first eight are mapped to the channels of acmp0, while the last eight are mapped to the channels of acmp1. each lesense channel has its own set of configuration registers. channel configuration is split into three registers; chx_timing, chx_interact, and chx_eval. individual timing for each sensor is configured in chx_timing, sensor interaction is configured in chx_interact, and configurations regarding evaluation of the measurements are done in chx_eval. for improved readability, chx_conf will be used to address
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 618 www.energymicro.com the channel configuration registers, chx_timing, chx_interact, and chx_eval, throughout this chapter. by default, the channel configuration registers are directly mapped to the channel number. configuring scanconf in ctrl makes it possible to alter this mapping. configuring scanconf to invmap will make channels 0-7 use the channel configuration registers for channels 8-15, and vice versa. this feature allows an application to quickly and easily switch configuration set for the channels. setting scanconf to toggle will make channel x alternate between using ch x _conf and ch x +8 _conf. the configuration used is decided by the state of the corresponding bit in scanres. for instance, if channel 3 is performing a scan and bit 3 in scanres is set, ch 11 _conf will be used. channels 8 through 15 will toggle between ch x _conf and ch x-8 _conf. this mode provides an easy way for implementation of hysteresis on channel events as threshold values can be changed depending on sensor status. setting scanconf to decdef will make the state of the decoder define which scan configuration to be used. if the decoder state is at index 8 or higher, channel x will use ch x+8 _conf, otherwise it will use ch x configuration. similarly, channels 8 through 15 will use ch x configuration when decoder state index is less than 8 and ch x-8 _conf when decoder state index is higher than 7. allowing the decoder state to define which configuration to use, enables easy implementation of for instance hysteresis, as different threshold values can be used for the same channel, depending on the state of the application. table 25.1 (p. 618 ) summarizes how channel configuration is selected for different setting of scanconf. table 25.1. lesense scan configuration selection scanconf dirmap invmap toggle decdef lesense channel x scanres[n] = 0 scanres[n] = 1 decstate < 8 decstate >= 8 0 <= x < 8 ch x _conf ch x +8 _conf ch x _conf ch x+8 _conf ch x _conf ch x+8 _conf 8 <= x < 16 ch x _conf ch x-8 _conf ch x _conf ch x-8 _conf ch x _conf ch x-8 _conf channels are enabled in the chen register, where bit x enables channel x. during a scan, all enabled channels are measured, starting with the lowest indexed channel. figure 25.2 (p. 619 ) illustrates a scan sequence with channels 3, 5, and 9 enabled. 25.3.2 scan sequence lesense runs on lfaclk lesense , which is a prescaled version of lfaclk. the prescaling factor for lfaclk lesense is selected in the cmu, available prescaling factors are: ? div1: lfaclk lesense = lfaclk/1 ? div2: lfaclk lesense = lfaclk/2 ? div4: lfaclk lesense = lfaclk/4 ? div8: lfaclk lesense = lfaclk/8 note lfaclk lesense should not exceed 50khz. all enabled channels are scanned each scan period. how a new scan is started is configured in the scanmode bit field in ctrl. if set to periodic, the scan frequency is generated using a counter which
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 619 www.energymicro.com is clocked by lfaclk lesense . this counter has its own prescaler. this prescaling factor is configured in pcpresc in timctrl. a new scan sequence is started each time the counter reaches the top value, pctop. the scan frequency is calculated using equation 25.1 (p. 619 ) . if scanmode is set to oneshot, a single scan will be made when start in cmd is set. to start a new scan on a prs event, set scanmode to prs and configure prs channel in prssel. the prs start signal needs to be active for at least one lfaclk lesense cycle to make sure lesense is able to register it. scan frequency f scan = lfaclk lesense /((1 + pctop)*2 pcpresc ) (25.1) it is possible to interleave additional sensor measurements in between the periodic scans. issuing a start command when lesense is idle will immediately start a new scan, without disrupting the frequency of the periodic scans. if the period counter overflows during the interleaved scan, the periodically scheduled scan will start immediately after the interleaved scan completes. figure 25.2. scan sequence ch3 ch5 ch9 ch3 ch5 ch9 start start scan period 25.3.3 sensor timing for each channel in the scan sequence, the lesense interface goes through three phases: idle phase, excite phase, and measure phase. the durations of the excite and measure phases are configured in the chx_timing registers. timing of the excite phase can be either a number of auxhfrco cycles or a number of lfaclk lesense cycles, depending on which one is selected in exclk. lesense includes two timers: a low frequency timer, running on lfaclk lesense , and a high frequency timer, running on auxhfrco. the low frequency timer can be prescaled by configuring lfpresc in timctrl, and the high frequency timer prescaling factor is configured in auxpresc in the same register. the duration of the measure phase is programmed via measuredly and sampledly. the output of the acmp will be inactive for measuredly exclk cycles after start of the sensor measurement. sampling of the sensor will happen after sampledly lfaclk lesense , or auxhfrco cycles, depending on the configuration of sampleclk. figure 25.3 (p. 619 ) depicts a sensor sequence where excitation and measure delay is timed using auxhfrco and the sample delay is timed using lfaclk lesense . the configurable measure- and sample delays enables lesense to easily define exact time windows for sensor measurements. a start delay can be inserted before sensor measurement begin by configuring startdly in timctrl. this delay can be used to ensure that the dac is done and voltages have stabilized before sensor measurement begins. figure 25.3. timing diagram, short excitation excite sample lfaclk lesense idle phase excit e phase idle phase sam ple delay measure phase start auxhfrco init st art delay measure delay dac refresh st art
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 620 www.energymicro.com 25.3.4 sensor interaction many sensor types require some type of excitation in order to work. lesense can generate a variety of sensor stimuli, both on the same pin as the measurement is to be made on, and on alternative pins. by default, excitation is performed on the pin associated with the channel, i.e. excitation and sensor measurement is performed on the same pin. the mode of the pin during the excitation phase is configured in exmode in chx_interact. the available modes during the excite phase are: ? disabled: the pin is disabled. ? high: the pin is driven high. ? low: the pin is driven low. ? dacout: the pin is connected to the output of a dac channel. note excitation with dac output is only available on channels 0, 1, 2, and 3 (dac0_ch0) and channels 12, 13, 14, and 15 (dac0_ch1). if the dac is in opamp-mode, setting exmode to dacout will result in excitation with output from the opamp. lesense is able to perform sensor excitation on another pin than the one to be measured. when altex in chx_interact is set, the excitation will occur on the alternative excite pin associated with the given channel. all lesense channels mapped to acmp0 have their alternative channel mapped to the corresponding channel on acmp1, and vice versa. alternatively, the alternative excite pins can be routed to the les_altex pins. mapping of the alternative excite pins is configured in altexmap in ctrl. table 25.2 (p. 620 ) summarizes the mapping of excitation pins for different configurations. table 25.2. lesense excitation pin mapping altex = 0 altex = 1 lesense channel altexmap = acmp altexmap = altex 0 acmp0_ch0 acmp1_ch0 les_altex0 1 acmp0_ch1 acmp1_ch1 les_altex1 2 acmp0_ch2 acmp1_ch2 les_altex2 3 acmp0_ch3 acmp1_ch3 les_altex3 4 acmp0_ch4 acmp1_ch4 les_altex4 5 acmp0_ch5 acmp1_ch5 les_altex5 6 acmp0_ch6 acmp1_ch6 les_altex6 7 acmp0_ch7 acmp1_ch7 les_altex7 8 acmp1_ch0 acmp0_ch0 les_altex0 9 acmp1_ch1 acmp0_ch1 les_altex1 10 acmp1_ch2 acmp0_ch2 les_altex2 11 acmp1_ch3 acmp0_ch3 les_altex3 12 acmp1_ch4 acmp0_ch4 les_altex4 13 acmp1_ch5 acmp0_ch5 les_altex5 14 acmp1_ch6 acmp0_ch6 les_altex6 15 acmp1_ch7 acmp0_ch7 les_altex7
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 621 www.energymicro.com figure 25.4 (p. 621 ) illustrates the sequencing of the pin associated with the active channel and its alternative excite pin. figure 25.4. pin sequencing excite lfaclk lesense idle phase excit e phase idle phase measure phase idleconf exmode z idleconf channel pin idleconf alt ernat e excit e pin idleconf exmode idleconf alt ernat e excit e pin idleconf z idleconf channel pin altex= 1 altex= 0 the alternative excite pins, les_altexn, have the possibility to excite regardless of what channel is active. setting aexn in altexconf will make les_altexn excite for all channels using alternative excitation, i.e. altex in chx_interact is set. note when exciting on the pin associated with the active channel, the pin will go through a tri- stated phase before returning to the idle configuration. this will not happen on pins used as alternative excitation pins. the pin configuration for the idle phase can be configured individually for each lesense channel and alternative excite pin in the idleconf and altexconf registers. the modes available are the same as the modes available in the excitation phase. in the measure phase, the pin mode on the active channel is always disabled (analog input). to enable lesense to control gpio, the pin has to be enabled in the route register. in addition, the given pin must be configured as push-pull. idleconf configuration should not be altered when pin enable for the given pin is set in route. 25.3.5 sensor evaluation sensor evaluation can be based on either analog comparator outputs, or the counter output. this is configured in the sample bit-field in chx_interact. the lesense counter is used to count pulses on the acmp output in the measurement phase. when a measurement phase is completed, the counter value is compared to the value configured in compthres in chx_eval. by configuring comp, it is possible to choose comparison mode: less than, or greater than or equal. if a comparison for a channel triggers, the corresponding bit in the result register, scanres, is set. to set an interrupt flag on a sensor event, configure setif in chx_interact. figure 25.5 (p. 622 ) illustrates how the counter value or acmp sample is used for evaluation and interrupt generation.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 622 www.energymicro.com figure 25.5. scan result and interrupt generation acmp sam ple lesense count er acmp counter chx_eval_scanresinv counter > = compthres counter < compthres ge less chx_eval_comp chx_interact_sample none level posedge negedge chx_interact_setif 0 set int errupt flag scanres[ x] sensorstate lesense includes the possibility to sample both analog comparators simultaneously, effectively cutting the time spent on sensor interaction in some applications in half. setting dualsample in ctrl enables this mode. in dual sample mode, the channels of acmp0 are paired together with the corresponding channel on acmp1, i.e. channel x on acmp0 and channel x on acmp1 are sampled simultaneously. the results from sensor measurements can be fed into the decoder register and/or stored in the result buffer. in this mode, the samples from the amcps are placed in the two lsbs of the result stored in the result buffer. results from both acmps will be evaluated for interrupt generation. 25.3.6 decoder many applications require some sort of processing of the sensor readings, for instance in the case of quadrature decoding. in quadrature decoding, the sensors repeatedly pass through a set of states which corresponds to the position of the sensors. this sequence, and many other decoding schemes, can be described as a finite state machine. to support this type of decoding without cpu intervention, lesense includes a highly configurable decoder, capable of decoding input from up to four sensors. the decoder is implemented as a programmable state machine with up to 16 states. when doing a sensor scan, the results from the sensors are placed in the decoder input register, sensorstate, if decode in chx_interact is set. the resulting position after a scan is illustrated in figure 25.6 (p. 622 ) , where the bottom blocks show how the sensorstate register is filled. when the scan sequence is complete, the decoder evaluates the state of the sensors chosen for decoding, as depicted in figure 25.6 (p. 622 ) . figure 25.6. sensor scan and decode sequence ch0 ch1 start start scan period decode ch2 ch3 ch0 ch1 decode ch2 ch3 ch0 result - - - ch0 result ch1 result - - ch0 result ch1 result ch2 result - ch0 result ch1 result ch2 result ch3 result sensorstate[ 0] sensorstate[ 3] ch0 result ch1 result ch2 result ch3 result ch0 result ch1 result ch2 result ch3 result ch0 result ch1 result ch2 result ch3 result ch0 result ch1 result ch2 result ch3 result the decoder is a programmable state machine with support for up to 16 states. the behavior of each state is individually configured in the stx_tconfa and stx_tconfb registers. the registers define possible transitions from the present state. if the sensor state matches comp in either stx_tconfa or stx_tconfb, a transition to the state defined in nextstate will be made. it is also possible to mask out one or more sensors using the mask bit field. the state of a masked sensor is interpreted as don't care.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 623 www.energymicro.com upon a state transition, lesense can generate a pulse on one or more of the decoder prs channels. which channel to generate a pulse on is configured in the prsact bit field. if prscnt in decctrl is set, count signals will be generated on decoder prs channels 0 and 1 according to the prsact configuration. in this mode, channel 0 will pulse each time a count event occurs while channel 1 indicates the count direction, 1 being up and 0 being down. the count direction will be kept at its previous state in between count events. the EFM32WG pulse counter may be used to keep track of events based on these prs outputs. if setif is set, the decoder interrupt flag will be set when the transition occurs. if intmap in decctrl and setif is set, a transition from state x will set the chx interrupt flag in addition to the decoder flag. setting chain in stx_tconfa enables the decoder to evaluate more than two possible transitions for each state. if none of the transitions defined in stx_tconfa or stx_tconfb matches, the decoder will jump to the next descriptor pair and evaluate the transitions defined there. the decoder uses two lfaclk lesense cycles for each descriptor pair to be evaluated. if errchk in ctrl is set, the decoder will check that the sensor state has not changed if none of the defined transitions match. the decerr interrupt flag will be set if none of the transitions match and the sensor state has changed. figure 25.7 (p. 623 ) illustrates state transitions. the "generate prs signals and set interrupt flag" blocks will perform actions according to the configuration in stx_tconfa and stx_tconfb. figure 25.7. decoder state transition evaluation st i + 1 _ tconf st i _ tconf state i nextstate ai nextstate bi nextstate ai + 1 nextstate bi + 1 generat e prs signals and set int errupt flag generat e prs signals and set int errupt flag generat e prs signals and set int errupt flag generat e prs signals and set int errupt flag set decerr int errupt flag sensorstate & ~ mask ai = comp ai & ~ mask ai y n sensorstate & ~ mask bi = comp bi & ~ mask bi y n chain i = 1 y n sensorstate & ~ mask ai + 1 = comp ai + 1 & ~ mask ai + 1 y n sensorstate & ~ mask bi + 1 = comp bi + 1 & ~ mask bi + 1 y n sensorstate changed & & errchk = 1 y n chain i + 1 = 1 y n
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 624 www.energymicro.com note if only one transition from a state is used, stx_tconfa and stx_tconfb should be configured equally. to prevent unnecessary interrupt requests or prs outputs when the decoder toggles back and forth between two states, a hysteresis option is available. the hysteresis function is triggered if a type a transition is preceded by a type b transition, and vice versa. a type a transition is a transition defined in stx_tconfa, and a type b transition is a transition defined in stx_tconfb. when descriptor chaining is used, a jump to another descriptor will cancel out the hysteresis effect. figure 25.8 (p. 624 ) illustrates how the hysteresis triggers upon state transitions. figure 25.8. decoder hysteresis st at e 0 st at e 1 1: b t ransit ion, no hyst eresis st at e 2 2: a t ransit ion, hyst eresis st at e 3 5: a t ransit ion, no hyst eresis 3: b t ransit ion, hyst eresis 4: a t ransit ion, hyst eresis a t ransit ion: transit ion defined in tconfa b t ransit ion : transit ion defined in tconfb the events suppressed by the hysteresis are configured in bit fields hystprs0-2 and hystirq in decctrl. ? when hystprsx is set, prs signal x is suppressed when the hysteresis triggers. ? when hystirq is set, interrupt requests are suppressed when the hysteresis triggers. note the decoder error interrupt flag, decerr, is not affected by the hysteresis. 25.3.7 measurement results part of the lesense ram is treated as a circular buffer for storage of up to 16 results from sensor measurements. each time lesense writes data to the result buffer, the result write pointer, ptr_wr, is incremented. each time a new result is read through the bufdata register, the result read pointer, ptr_rd, is incremented. the read pointer will not be incremented if there is no valid, unread data in the result buffer. by default lesense will not write additional data to a full result buffer until the data is read by software or dma. setting bufow in ctrl enables lesense to write to the result buffer, even if it is full. in this mode, the result read pointer will follow the write pointer if the buffer is full. the result of this is that data read from the result read register, bufdata, is the oldest unread result. the location pointers are available in ptr. the result buffer has three status flags; bufdatav, bufhalffull, and buffull. the flags indicate when new data is available, when the buffer is half full, and when it is full, respectively. the interrupt flag bufdatav is set when data is available in the buffer. buflevel is set when the buffer is either full or half-full, depending on the configuration of bufidl in ctrl. if the result buffer overflows, the bufof interrupt flag will be set. during a scan, the state of each sensor is stored in scanres. if a sensor triggers, a 1 is stored in scanres, else a 0 is stored in scanres. whether or not a sensor is said to be triggered depends of the configuration for the given channel. if sample is set to acmp, the sensor is said to be triggered if the output from the analog comparator is 1 when sensor sampling is performed. if sample is set to counter, a sensor is said to be triggered if the lesense counter value is greater than or equal, or
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 625 www.energymicro.com less than compthres, depending on the configuration of comp. if strsample in chx_eval is set, the counter value or acmp sample for each channel will be stored in the lesense result buffer. if strscanres in ctrl is set, the result vector, scanres, will also be stored in the result buffer. this will be stored after each scan and will be interleaved with the counter values. the contents of the result buffer can be read from bufdata or from buf[x]_data. when reading from buf[x]_data, neither the result read pointer or the status flags bufdatav, bufhalffull, or buffull will be updated. when reading through the bufdata register, the oldest unread result will be read. figure 25.9. circular result buffer buf0_data buf1_data buf2_data buf3_data buf12_data buf13_data buf14_data buf15_data bufdata ptr_rd lesense ptr_wr ch3 result ch5 result ch9 result scanres ch3 result ch5 result ch9 result scanres the right hand side of figure 25.9 (p. 625 ) illustrates how the result buffer would be filled when channels 3,5, and 9 are enabled and have strsample in chx_eval set, in addition to strscanres in ctrl. the measurement result from the three channels will be sequentially written during the scan, while scanres is written to the result buffer upon scan completion. 25.3.8 dac interface lesense is able to drive the dac for generation of accurate reference voltages. dac channels 0 and 1 are individually configured in the perctrl register. the conversion mode can be set to either continuous, sample/hold or sample/off. for further details about these modes, refer to section 29.3.1 (p. 705 ) . both dac channels are refreshed prior to each sensor measurement, as depicted in figure 25.3 (p. 619 ) . the conversion data is either taken from the data registers in the EFM32WG dac interface (dac0_ch0data and dac0_ch1data) or from the acmpthres bit- field in the chx_interact register for the active lesense channel. dac data used is configured in dacchxdata in perctrl. the dac interface runs on auxhfrco and will enable this when it is needed. the dacpresc bit-field in perctrl is used to prescale the auxhfrco to achieve wanted clock frequency for the lesense dac interface. the frequency should not exceed 500khz, i.e. dacpresc has to be set to at least 1. the prescaler may also be used to tune how long the dac should drive its outputs in sample/off mode. bias configuration, calibration and reference selection is done in the EFM32WG dac module and lesense will not override these configurations. if a bandgap reference is selected for the dac, the dacref bit in perctrl should be set to bandgap. lesense has the possibility to control switches that connect the dac outputs to the pins associated with acmp0_ch0-3 and acmp1_ch12-15. this makes lesense able to excite sensors with output from the dac channels. the dac may be chosen as reference to the analog comparators for accurate reference generation. if the dac is configured in continuous or sample/hold mode this does not require any external components. if sample/off mode is used, an external capacitor is needed to keep the voltage in between samples. to connect the input from the dac to the acmp to this external capacitor, connect the capacitor to the dac pin for the given channel and set opaxshort in dac_opactrl. note the dac mode should not be altered while dacactive in status is set
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 626 www.energymicro.com 25.3.9 acmp interface the acmps are used to measure the sensors, and have to be configured according to the application in order for lesense to work properly. depending on the configuration in the acmp0mode and acmp1mode bit-fields in perctrl, lesense will take control of the positive input mux and the vdd scaling factor (vddlevel) for acmp0 and acmp1. the remaining configuration of the analog comparators are done in the acmp register interface. it is recommended to set the muxen bit in acmpn_ctrl for the acmps used by lesense. each channel has the possibility to control the value of the vdd scaling factor on the negative input of the acmp, vddlevel in acmp_inputsel. this is done in the 6 lsbs of acmpthres in chx_interact. lesense automatically controls the acmp mux to connect the correct channel. 25.3.10 acmp and dac duty cycling by default, the analog comparators and dac are shut down in between lesense scans to save energy. if this is not wanted, warmupmode in perctrl can be configured to prevent them from being shut down. both the dac and analog comparators rely on a bias module for correct operation. this bias module has a low power mode which consumes less energy at the cost of reduced accuracy. biasmode in biasctrl configures how the bias module is controlled by lesense. when set to dutycycle, lesense will set the bias module in high accuracy mode whenever lesense is active, and keep it in the low power mode otherwise. when biasmode is set to highacc, the high accuracy mode is always selected. when set to donttouch, lesense will not control the bias module. 25.3.11 dma requests lesense issues a dma request when the result buffer is either full or half full, depending on the configuration of bufidl in ctrl. the request is cleared when the buffer level drops below the threshold defined in bufidl. a single dma request is also set whenever there is unread data in the buffer. dmawu in ctrl configures at which buffer level lesense should wake-up the dma when in em2. note the dma controller should always fetch data from the bufdata register. 25.3.12 prs output lesense is an asynchronous prs producer and has nineteen prs outputs. the decoder has three outputs and in addition, all bits in the scanres register are available as prs outputs. for further information on the decoder prs output, refer to section 25.3.6 (p. 622 ) . 25.3.13 ram lesense includes a ram block used for storage of configuration and results. if lesense is not used, this ram block can be powered down eliminating its current consumption due to leakage. the ram is powered down by setting the ram bit in the powerdown register. once the ram has been shut down it cannot be turned back on without a reset of the chip. registers mapped to the ram include: stx_tconfa, stx_tconfb, bufx_data, bufdata, chx_timing, chx_interact, and chx_eval. these registers have unknown value out of reset and have to be initialized before use. note read-modify-write operations on uninitialized ram register produces undefined values. 25.3.14 application examples 25.3.14.1 capacitive sense figure 25.10 (p. 627 ) illustrates how the EFM32WG can be configured to monitor four capacitive buttons.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 627 www.energymicro.com figure 25.10. capacitive sense setup efm32 acmp0_ch0 acmp0_ch1 acmp0_ch2 acmp0_ch3 the following steps show how to configure lesense to scan through the four buttons 100 times per second, issuing an interrupt if one of them is pressed. 1. assuming lfaclk lesense is 32khz, set pcpresc to 3 and pctop to 39 in ctrl. this will make the lesense scan frequency 100hz. 2. enable channels 0 through 3 in chen and set idleconf for these channels to disabled. in capacitive sense mode, the gpio should always be disabled (analog input). 3. configure the acmp to operate in capsense mode, refer to section 26.3.5 (p. 664 ) for details. 4. configure the following bit fields in chx_conf, for channels 0 through 3: a. set extime to 0. no excitation is needed in this mode. b. set sample to counter and comp to less. this makes lesense interpret a sensor as active if the frequency on a channel drops below the threshold, i.e. the button is pressed. c. set sampledly to an appropriate value, each sensor will be measured for sampledly/ lfaclk lesense seconds. measuredly should be set to 0 5. set ctrthreshold to an appropriate value. an interrupt will be issued if the counter value for a sensor is below this threshold after the measurement phase. 6. enable interrupts on channels 0 through 3. 7. start scan sequence by writing a 1 to start in cmd. in a capacitive sense application, it might be required to calibrate the threshold values on a periodic basis, this is done in order to compensate for humidity and other physical variations. lesense is able to store up to 16 counter values from a configurable number of channels, making it possible to collect sample data while in em2. when calibration is to be performed, the cpu only has to be woken up for a short period of time as the data to be processed already lies in the result registers. to enable storing of the count value for a channel, set strsample in the chx_interact register. 25.3.14.2 lc sensor figure 25.11 (p. 627 ) below illustrates how the EFM32WG can be set up to monitor four lc sensors. figure 25.11. lc sensor setup efm32 acmp0_ch0 acmp0_ch1 acmp0_ch2 dac0_out0 x x x x acmp0_ch3 lesense can be used to excite and measure the damping factor in lc sensor oscillations. to measure the damping factor, the acmp can be used to generate a high output each time the sensor voltage exceeds a certain level. these pulses are counted using an asynchronous counter and compared with
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 628 www.energymicro.com the threshold in compthres in the chx_eval register. if the number of pulses exceeds the threshold level, the sensor is said to be active, otherwise it is inactive. figure 25.12 (p. 628 ) illustrates how the output pulses from the acmp correspond to damping of the oscillations. the results from sensor evaluation can automatically be fed into the decoder in order to keep track of rotations. figure 25.12. lc sensor oscillations the following steps show how to configure lesense to scan through the four lc sensors 100 times per second. 1. assuming lfaclk lesense is 32khz, set pcpresc to 3 and pctop to 39 in ctrl. this will make the lesense scan frequency 100hz. 2. enable the dac and configure it to produce a voltage of vdd/2. 3. enable channels 0 through 3 in chen. set idleconf for the active channels to dacout. the channel pins should be set to vdd/2 in the idle phase to damp the oscillations. 4. configure the acmp to use scaled vdd as negative input, refer to acmp chapter for details. 5. enable and configure pcnt and asynchronous prs. 6. configure the gpios used as pushpull. 7. configure the following bit fields in chx_conf, for channels 0 through 3: a. set exclk to auxhfrco. auxhfrco is needed to achieve short excitation time. b. set extime to an appropriate value. excitation will last for extime/auxhfrco seconds. c. set exmode to low. the lc sensors are excited by pulling the excitation pin low. d. set sample to counter and comp to less. status of each sensor is evaluated based on the number of pulses generated by the acmp. if they are less than the threshold value, the sensor is said to be active. e. set sampledly to an appropriate value, each sensor will be measured for sampledly/ lfaclk lesense seconds. 8. set ctrthreshold to an appropriate value. if the sensor is active, the counter value after the measurement phase should be less than the threshold. if it inactive, the counter value should be greater than the threshold. 9. start scan sequence by writing a 1 to start in cmd. 25.3.14.3 lesense decoder 1 the example below illustrates how the lesense module can be used for decoding using three sensors figure 25.13. fsm example 1 0 1 2 3 7 6 5 4 001 000 011 001 010 011 110 111 111 101 101 100 010 110 000 100 x x x st at e index sensor value to set up the decoder to decode rotation using the encoding scheme seen in figure 25.13 (p. 628 ) , configure the following lesense registers:
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 629 www.energymicro.com 1. configure the channels to be used, be sure to set decode in chx_eval. 2. set prscnt to enable generation of count waveforms on prs. also configure a pcnt to listen to the prs channels and count accordingly. 3. configure the following in stx_tconfa and stx_tconfb: a. set mask = 0b1000 in stx_tconfa and stx_tconfb for all used states. this enables three sensors to be evaluated by the decoder. b. configure the remaining bit fields in stx_tconfa and stx_tconfb as described in table 25.3 (p. 629 ) . table 25.3. lesense decoder configuration register tconfa_nextstate tconfa_comp tconfa_prsact tconfb_nextstate tconfb_comp tconfb_prsact st0 1 0b001 up 7 0b100 down st1 2 0b011 up 0 0b000 down st2 3 0b010 up 1 0b001 down st3 4 0b110 up 2 0b011 down st4 5 0b111 up 3 0b010 down st5 6 0b101 up 4 0b110 down st6 7 0b100 up 5 0b111 down st7 0 0b000 up 6 0b101 down 4. to initialize the decoder, run one scan, and read the present sensor status from sensorstate. then write the index of this state to decstate. 5. write to start in cmd to start scanning of sensors and decoding. 25.3.14.4 lesense decoder 2 the example below illustrates how the lesense decoder can be used to implement the state machine seen in figure 25.14 (p. 629 ) . figure 25.14. fsm example 2 0 2 4 6 8 0010 0000 0001 0000 0001 0011 0011 0010 1xxx 1xxx 1xxx 1xxx st at e index sensor value 1. configure stx_tconfa and stx_tconfb as described in table 25.4 (p. 630 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 630 www.energymicro.com table 25.4. lesense decoder configuration register nextstate comp mask chain st0_tconfa 8 0b1000 0b0111 1 st0_tconfb 2 0b0001 0b1000 - st1_tconfa 6 0b0010 0b1000 0 st1_tconfb 6 0b0010 0b1000 - st2_tconfa 8 0b1000 0b0111 1 st2_tconfb 4 0b0011 0b1000 - st3_tconfa 0 0b0000 0b1000 0 st3_tconfb 0 0b0000 0b1000 - st4_tconfa 8 0b1000 0b0111 1 st4_tconfb 6 0b0010 0b1000 - st5_tconfa 2 0b0001 0b1000 0 st5_tconfb 2 0b0001 0b1000 - st6_tconfa 8 0b1000 0b0111 1 st6_tconfb 0 0b0000 0b1000 - st7_tconfa 4 0b0011 0b1000 0 st7_tconfb 4 0b0011 0b1000 - 2. to initialize the decoder, run one scan, and read the present sensor status from sensorstate. then write the index of this state to decstate. 3. write to start in cmd to start scanning of sensors and decoding.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 631 www.energymicro.com 25.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 lesense_ctrl rw control register 0x004 lesense_timctrl rw timing control register 0x008 lesense_perctrl rw peripheral control register 0x00c lesense_decctrl rw decoder control register 0x010 lesense_biasctrl rw bias control register 0x014 lesense_cmd w1 command register 0x018 lesense_chen rw channel enable register 0x01c lesense_scanres r scan result register 0x020 lesense_status r status register 0x024 lesense_ptr r result buffer pointers 0x028 lesense_bufdata r result buffer data register 0x02c lesense_curch r current channel index 0x030 lesense_decstate rwh current decoder state 0x034 lesense_sensorstate rwh decoder input register 0x038 lesense_idleconf rw gpio idle phase configuration 0x03c lesense_altexconf rw alternative excite pin configuration 0x040 lesense_if r interrupt flag register 0x044 lesense_ifc w1 interrupt flag clear register 0x048 lesense_ifs w1 interrupt flag set register 0x04c lesense_ien rw interrupt enable register 0x050 lesense_syncbusy r synchronization busy register 0x054 lesense_route rw i/o routing register 0x058 lesense_powerdown rw lesense ram power-down register 0x200 lesense_st0_tconfa rw state transition configuration a 0x204 lesense_st0_tconfb rw state transition configuration b ... lesense_stx_tconfa rw state transition configuration a ... lesense_stx_tconfb rw state transition configuration b 0x278 lesense_st15_tconfa rw state transition configuration a 0x27c lesense_st15_tconfb rw state transition configuration b 0x280 lesense_buf0_data rw scan results ... lesense_bufx_data rw scan results 0x2bc lesense_buf15_data rw scan results 0x2c0 lesense_ch0_timing rw scan configuration 0x2c4 lesense_ch0_interact rw scan configuration 0x2c8 lesense_ch0_eval rw scan configuration ... lesense_chx_timing rw scan configuration ... lesense_chx_interact rw scan configuration ... lesense_chx_eval rw scan configuration 0x3b0 lesense_ch15_timing rw scan configuration 0x3b4 lesense_ch15_interact rw scan configuration
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 632 www.energymicro.com offset name type description 0x3b8 lesense_ch15_eval rw scan configuration 25.5 register description 25.5.1 lesense_ctrl - control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 0 0 0 0 0 0 0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw rw rw rw rw name debugrun dmawu bufidl strscanres bufow dualsample altexmap acmp1inv acmp0inv scanconf prssel scanmode bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 debugrun 0 rw debug mode run enable set to keep lesense running in debug mode. value description 0 lesense can not start new scans in debug mode 1 lesense can start new scans in debug mode 21:20 dmawu 0x0 rw dma wake-up from em2 value mode description 0 disable no dma wake-up from em2 1 bufdatav dma wake-up from em2 when data is valid in the result buffer 2 buflevel dma wake-up from em2 when the result buffer is full/half-full depending on bufidl configuration 19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18 bufidl 0 rw result buffer interrupt and dma trigger level value mode description 0 halffull dma and interrupt flags set when result buffer is half-full 1 full dma and interrupt flags set when result buffer is full 17 strscanres 0 rw enable storing of scanres when set, scanres will be stored in the result buffer after each scan 16 bufow 0 rw result buffer overwrite if set, lesense will always write to the result buffer, even if it is full 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13 dualsample 0 rw enable dual sample mode when set, both acmps will be sampled simultaneously. 12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11 altexmap 0 rw alternative excitation map
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 633 www.energymicro.com bit name reset access description value mode description 0 altex alternative excitation is mapped to the les_altex pins. 1 acmp alternative excitation is mapped to the pins of the other acmp. 10 acmp1inv 0 rw invert analog comparator 1 output 9 acmp0inv 0 rw invert analog comparator 0 output 8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:6 scanconf 0x0 rw select scan configuration these bits control which chx_conf registers to be used. value mode description 0 dirmap the channel configuration register registers used are directly mapped to the channel number. 1 invmap the channel configuration register registers used are ch x+8 _conf for channels 0-7 and ch x-8 _conf for channels 8-15. 2 toggle the channel configuration register registers used toggles between ch x _conf and ch x+8 _conf when channel x triggers 3 decdef the decoder state defines the conf registers to be used. 5:2 prssel 0x0 rw scan start prs select select prs source for scan start if scanmode is set to prs. value mode description 0 prsch0 prs channel 0 selected as input 1 prsch1 prs channel 1 selected as input 2 prsch2 prs channel 2 selected as input 3 prsch3 prs channel 3 selected as input 4 prsch4 prs channel 4 selected as input 5 prsch5 prs channel 5 selected as input 6 prsch6 prs channel 6 selected as input 7 prsch7 prs channel 7 selected as input 8 prsch8 prs channel 8 selected as input 9 prsch9 prs channel 9 selected as input 10 prsch10 prs channel 10 selected as input 11 prsch11 prs channel 11 selected as input 1:0 scanmode 0x0 rw configure scan mode these bits control how the scan frequency is decided value mode description 0 periodic a new scan is started each time the period counter overflows 1 oneshot a single scan is performed when start in cmd is set 2 prs pulse on prs channel 25.5.2 lesense_timctrl - timing control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 634 www.energymicro.com offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x00 0x0 0x0 0x0 access rw rw rw rw rw name startdly pctop pcpresc lfpresc auxpresc bit name reset access description 31:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23:22 startdly 0x0 rw start delay configuration delay sensor interaction startdelay lfaclk lesense cycles for each channel 21:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19:12 pctop 0x00 rw period counter top value these bits contain the top value for the period counter. 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 pcpresc 0x0 rw period counter prescaling value mode description 0 div1 the period counter clock frequency is lfaclk lesense /1 1 div2 the period counter clock frequency is lfaclk lesense /2 2 div4 the period counter clock frequency is lfaclk lesense /4 3 div8 the period counter clock frequency is lfaclk lesense /8 4 div16 the period counter clock frequency is lfaclk lesense /16 5 div32 the period counter clock frequency is lfaclk lesense /32 6 div64 the period counter clock frequency is lfaclk lesense /64 7 div128 the period counter clock frequency is lfaclk lesense /128 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:4 lfpresc 0x0 rw prescaling factor for low frequency timer value mode description 0 div1 low frequency timer is clocked with lfaclk lesense /1 1 div2 low frequency timer is clocked with lfaclk lesense /2 2 div4 low frequency timer is clocked with lfaclk lesense /4 3 div8 low frequency timer is clocked with lfaclk lesense /8 4 div16 low frequency timer is clocked with lfaclk lesense /16 5 div32 low frequency timer is clocked with lfaclk lesense /32 6 div64 low frequency timer is clocked with lfaclk lesense /64 7 div128 low frequency timer is clocked with lfaclk lesense /128 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 auxpresc 0x0 rw prescaling factor for high frequency timer value mode description 0 div1 high frequency timer is clocked with auxhfrco/1 1 div2 high frequency timer is clocked with auxhfrco/2 2 div4 high frequency timer is clocked with auxhfrco/4 3 div8 high frequency timer is clocked with auxhfrco/8
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 635 www.energymicro.com 25.5.3 lesense_perctrl - peripheral control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0 0x00 0x0 0x0 0x0 0x0 0 0 access rw rw rw rw rw rw rw rw rw rw rw name warmupmode acmp1mode acmp0mode dacref dacpresc dacch1out dacch0out dacch1conv dacch0conv dacch1data dacch0data bit name reset access description 31:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27:26 warmupmode 0x0 rw acmp and dac duty cycle mode value mode description 0 normal the analog comparators and dac are shut down when lesense is idle 1 keepacmpwarm the analog comparators are kept powered up when lesense is idle 2 keepdacwarm the dac is kept powered up when lesense is idle 3 keepacmpdacwarm the analog comparators and dac are kept powered up when lesense is idle 25:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23:22 acmp1mode 0x0 rw acmp1 mode configure how lesense controls acmp1 value mode description 0 disable lesense does not control acmp1 1 mux lesense controls the input mux (possel) of acmp1 2 muxthres lesense controls the input mux and the threshold value (vddlevel) of acmp1 21:20 acmp0mode 0x0 rw acmp0 mode configure how lesense controls acmp0 value mode description 0 disable lesense does not control acmp0 1 mux lesense controls the input mux (possel) of acmp0 2 muxthres lesense controls the input mux (possel) and the threshold value (vddlevel) of acmp0 19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18 dacref 0 rw dac bandgap reference used set to bandgap if the dac is configured to use bandgap reference value mode description 0 vdd dac uses vdd reference 1 bandgap dac uses bandgap reference 17:15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14:10 dacpresc 0x00 rw dac prescaler configuration. prescaling factor of dacpresc+1 for the lesense dac interface 9:8 dacch1out 0x0 rw dac channel 1 output mode value mode description 0 disable dac ch1 output to pin and acmp/adc disabled
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 636 www.energymicro.com bit name reset access description value mode description 1 pin dac ch1 output to pin enabled, output to adc and acmp disabled 2 adcacmp dac ch1 output to pin disabled, output to adc and acmp enabled 3 pinadcacmp dac ch1 output to pin, adc, and acmp enabled. 7:6 dacch0out 0x0 rw dac channel 0 output mode value mode description 0 disable dac ch0 output to pin and acmp/adc disabled 1 pin dac ch0 output to pin enabled, output to adc and acmp disabled 2 adcacmp dac ch0 output to pin disabled, output to adc and acmp enabled 3 pinadcacmp dac ch0 output to pin, adc, and acmp enabled. 5:4 dacch1conv 0x0 rw dac channel 1 conversion mode value mode description 0 disable lesense does not control dac ch1. 1 continuous dac channel 1 is driven in continuous mode. 2 samplehold dac channel 1 is driven in sample hold mode. 3 sampleoff dac channel 1 is driven in sample off mode. 3:2 dacch0conv 0x0 rw dac channel 0 conversion mode value mode description 0 disable lesense does not control dac ch0. 1 continuous dac channel 0 is driven in continuous mode. 2 samplehold dac channel 0 is driven in sample hold mode. 3 sampleoff dac channel 0 is driven in sample off mode. 1 dacch1data 0 rw dac ch1 data selection. configure dac data control. value mode description 0 dacdata dac data is defined by ch1data in the dac interface. 1 acmpthres dac data is defined by acmpthres in chx_interact. 0 dacch0data 0 rw dac ch0 data selection. value mode description 0 dacdata dac data is defined by ch0data in the dac interface. 1 acmpthres dac data is defined by acmpthres in chx_interact. 25.5.4 lesense_decctrl - decoder control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0x0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw name prssel3 prssel2 prssel1 prssel0 input prscnt hystirq hystprs2 hystprs1 hystprs0 intmap errchk disable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 637 www.energymicro.com bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:22 prssel3 0x0 rw select prs input for bit 3 of the lesense decoder value mode description 0 prsch0 prs channel 0 selected as input 1 prsch1 prs channel 1 selected as input 2 prsch2 prs channel 2 selected as input 3 prsch3 prs channel 3 selected as input 4 prsch4 prs channel 4 selected as input 5 prsch5 prs channel 5 selected as input 6 prsch6 prs channel 6 selected as input 7 prsch7 prs channel 7 selected as input 8 prsch8 prs channel 8 selected as input 9 prsch9 prs channel 9 selected as input 10 prsch10 prs channel 10 selected as input 11 prsch11 prs channel 11 selected as input 21:18 prssel2 0x0 rw select prs input for bit 2 of the lesense decoder value mode description 0 prsch0 prs channel 0 selected as input 1 prsch1 prs channel 1 selected as input 2 prsch2 prs channel 2 selected as input 3 prsch3 prs channel 3 selected as input 4 prsch4 prs channel 4 selected as input 5 prsch5 prs channel 5 selected as input 6 prsch6 prs channel 6 selected as input 7 prsch7 prs channel 7 selected as input 8 prsch8 prs channel 8 selected as input 9 prsch9 prs channel 9 selected as input 10 prsch10 prs channel 10 selected as input 11 prsch11 prs channel 11 selected as input 17:14 prssel1 0x0 rw select prs input for the bit 1 of the lesense decoder value mode description 0 prsch0 prs channel 0 selected as input 1 prsch1 prs channel 1 selected as input 2 prsch2 prs channel 2 selected as input 3 prsch3 prs channel 3 selected as input 4 prsch4 prs channel 4 selected as input 5 prsch5 prs channel 5 selected as input 6 prsch6 prs channel 6 selected as input 7 prsch7 prs channel 7 selected as input 8 prsch8 prs channel 8 selected as input 9 prsch9 prs channel 9 selected as input 10 prsch10 prs channel 10 selected as input 11 prsch11 prs channel 11 selected as input 13:10 prssel0 0x0 rw select prs input for the bit 0 of the lesense decoder value mode description 0 prsch0 prs channel 0 selected as input 1 prsch1 prs channel 1 selected as input 2 prsch2 prs channel 2 selected as input
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 638 www.energymicro.com bit name reset access description value mode description 3 prsch3 prs channel 3 selected as input 4 prsch4 prs channel 4 selected as input 5 prsch5 prs channel 5 selected as input 6 prsch6 prs channel 6 selected as input 7 prsch7 prs channel 7 selected as input 8 prsch8 prs channel 8 selected as input 9 prsch9 prs channel 9 selected as input 10 prsch10 prs channel 10 selected as input 11 prsch11 prs channel 11 selected as input 9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 input 0 rw select input to the lesense decoder value mode description 0 sensorstate the sensorstate register is used as input to the decoder. 1 prs prs channels are used as input to the decoder. 7 prscnt 0 rw enable count mode on decoder prs channels 0 and 1 when set, decoder prs0 and prs1 will be used to produce output which can be used by a pcnt to count up or down. 6 hystirq 0 rw enable decoder hysteresis on interrupt requests when set, hysteresis is enabled in the decoder, suppressing interrupt requests. 5 hystprs2 0 rw enable decoder hysteresis on prs2 output when set, hysteresis is enabled in the decoder, suppressing changes on prs channel 2 4 hystprs1 0 rw enable decoder hysteresis on prs1 output when set, hysteresis is enabled in the decoder, suppressing changes on prs channel 1 3 hystprs0 0 rw enable decoder hysteresis on prs0 output when set, hysteresis is enabled in the decoder, suppressing changes on prs channel 0 2 intmap 0 rw enable decoder to channel interrupt mapping when set, a transition from state x in the decoder will set interrupt flag chx 1 errchk 0 rw enable check of current state when set, the decoder checks the current state in addition to the states defined in tconf 0 disable 0 rw disable the decoder when set, the decoder is disabled. when disabled the decoder will keep its current state 25.5.5 lesense_biasctrl - bias control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 access rw name biasmode bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 639 www.energymicro.com bit name reset access description 1:0 biasmode 0x0 rw select bias mode value mode description 0 dutycycle bias module duty cycled between low power and high accuracy mode 1 highacc bias module always in high accuracy mode 2 donttouch bias module is controlled by the emu and not affected by lesense 25.5.6 lesense_cmd - command register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name clearbuf decode stop start bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 clearbuf 0 w1 clear result buffer 2 decode 0 w1 start decoder 1 stop 0 w1 stop scanning of sensors if issued during a scan, the command will take effect after scan completion. 0 start 0 w1 start scanning of sensors. 25.5.7 lesense_chen - channel enable register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name chen bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 chen 0x0000 rw enable scan channel
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 640 www.energymicro.com bit name reset access description set bit x to enable channel x 25.5.8 lesense_scanres - scan result register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access r name scanres bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 scanres 0x0000 r scan results bit x will be set depending on channel x evaluation 25.5.9 lesense_status - status register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access r r r r r r name dacactive scanactive running buffull bufhalffull bufdatav bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 dacactive 0 r lesense dac interface is active 4 scanactive 0 r lesense is currently interfacing sensors. 3 running 0 r lesense is active 2 buffull 0 r result buffer full set when the result buffer is full 1 bufhalffull 0 r result buffer half full set when the result buffer is half full
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 641 www.energymicro.com bit name reset access description 0 bufdatav 0 r result data valid set when data is available in the result buffer. cleared when the buffer is empty. 25.5.10 lesense_ptr - result buffer pointers (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 access r r name wr rd bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8:5 wr 0x0 r result buffer write pointer. these bits show the next index in the result buffer to be written to. incremented when lesense writes to result buffer 4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 rd 0x0 r result buffer read pointer. these bits show the index of the oldest unread data in the result buffer. incremented on read from bufdata. 25.5.11 lesense_bufdata - result buffer data register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxx access r name bufdata bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 bufdata 0xxxxx r result data this register can be used to read the oldest unread data from the result buffer. 25.5.12 lesense_curch - current channel index (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 642 www.energymicro.com offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 access r name curch bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 curch 0x0 r shows the index of the current channel 25.5.13 lesense_decstate - current decoder state (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 access rwh name decstate bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 decstate 0x0 rwh shows the current decoder state 25.5.14 lesense_sensorstate - decoder input register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 access rwh name sensorstate bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 sensorstate 0x0 rwh shows the status of sensors chosen as input to the decoder
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 643 www.energymicro.com 25.5.15 lesense_idleconf - gpio idle phase configuration (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name ch15 ch14 ch13 ch12 ch11 ch10 ch9 ch8 ch7 ch6 ch5 ch4 ch3 ch2 ch1 ch0 bit name reset access description 31:30 ch15 0x0 rw channel 15 idle phase configuration value mode description 0 disable ch15 output is disabled in idle phase 1 high ch15 output is high in idle phase 2 low ch15 output is low in idle phase 3 dacch1 ch15 output is connected to dac ch1 output in idle phase 29:28 ch14 0x0 rw channel 14 idle phase configuration value mode description 0 disable ch14 output is disabled in idle phase 1 high ch14 output is high in idle phase 2 low ch14 output is low in idle phase 3 dacch1 ch14 output is connected to dac ch1 output in idle phase 27:26 ch13 0x0 rw channel 13 idle phase configuration value mode description 0 disable ch13 output is disabled in idle phase 1 high ch13 output is high in idle phase 2 low ch13 output is low in idle phase 3 dacch1 ch13 output is connected to dac ch1 output in idle phase 25:24 ch12 0x0 rw channel 12 idle phase configuration value mode description 0 disable ch12 output is disabled in idle phase 1 high ch12 output is high in idle phase 2 low ch12 output is low in idle phase 3 dacch1 ch12 output is connected to dac ch1 output in idle phase 23:22 ch11 0x0 rw channel 11 idle phase configuration value mode description 0 disable ch11 output is disabled in idle phase 1 high ch11 output is high in idle phase 2 low ch11 output is low in idle phase 21:20 ch10 0x0 rw channel 10 idle phase configuration value mode description 0 disable ch10 output is disabled in idle phase 1 high ch10 output is high in idle phase
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 644 www.energymicro.com bit name reset access description value mode description 2 low ch10 output is low in idle phase 19:18 ch9 0x0 rw channel 9 idle phase configuration value mode description 0 disable ch9 output is disabled in idle phase 1 high ch9 output is high in idle phase 2 low ch9 output is low in idle phase 17:16 ch8 0x0 rw channel 8 idle phase configuration value mode description 0 disable ch8 output is disabled in idle phase 1 high ch8 output is high in idle phase 2 low ch8 output is low in idle phase 15:14 ch7 0x0 rw channel 7 idle phase configuration value mode description 0 disable ch7 output is disabled in idle phase 1 high ch7 output is high in idle phase 2 low ch7 output is low in idle phase 13:12 ch6 0x0 rw channel 6 idle phase configuration value mode description 0 disable ch6 output is disabled in idle phase 1 high ch6 output is high in idle phase 2 low ch6 output is low in idle phase 11:10 ch5 0x0 rw channel 5 idle phase configuration value mode description 0 disable ch5 output is disabled in idle phase 1 high ch5 output is high in idle phase 2 low ch5 output is low in idle phase 9:8 ch4 0x0 rw channel 4 idle phase configuration value mode description 0 disable ch4 output is disabled in idle phase 1 high ch4 output is high in idle phase 2 low ch4 output is low in idle phase 7:6 ch3 0x0 rw channel 3 idle phase configuration value mode description 0 disable ch3 output is disabled in idle phase 1 high ch3 output is high in idle phase 2 low ch3 output is low in idle phase 3 dacch0 ch3 output is connected to dac ch0 output in idle phase 5:4 ch2 0x0 rw channel 2 idle phase configuration
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 645 www.energymicro.com bit name reset access description value mode description 0 disable ch2 output is disabled in idle phase 1 high ch2 output is high in idle phase 2 low ch2 output is low in idle phase 3 dacch0 ch2 output is connected to dac ch0 output in idle phase 3:2 ch1 0x0 rw channel 1 idle phase configuration value mode description 0 disable ch1 output is disabled in idle phase 1 high ch1 output is high in idle phase 2 low ch1 output is low in idle phase 3 dacch0 ch1 output is connected to dac ch0 output in idle phase 1:0 ch0 0x0 rw channel 0 idle phase configuration value mode description 0 disable ch0 output is disabled in idle phase 1 high ch0 output is high in idle phase 2 low ch0 output is low in idle phase 3 dacch0 ch0 output is connected to dac ch0 output in idle phase 25.5.16 lesense_altexconf - alternative excite pin configuration (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name aex7 aex6 aex5 aex4 aex3 aex2 aex1 aex0 idleconf7 idleconf6 idleconf5 idleconf4 idleconf3 idleconf2 idleconf1 idleconf0 bit name reset access description 31:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23 aex7 0 rw altex7 always excite enable 22 aex6 0 rw altex6 always excite enable 21 aex5 0 rw altex5 always excite enable 20 aex4 0 rw altex4 always excite enable 19 aex3 0 rw altex3 always excite enable 18 aex2 0 rw altex2 always excite enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 646 www.energymicro.com bit name reset access description 17 aex1 0 rw altex1 always excite enable 16 aex0 0 rw altex0 always excite enable 15:14 idleconf7 0x0 rw altex7 idle phase configuration value mode description 0 disable altex7 output is disabled in idle phase 1 high altex7 output is high in idle phase 2 low altex7 output is low in idle phase 13:12 idleconf6 0x0 rw altex6 idle phase configuration value mode description 0 disable altex6 output is disabled in idle phase 1 high altex6 output is high in idle phase 2 low altex6 output is low in idle phase 11:10 idleconf5 0x0 rw altex5 idle phase configuration value mode description 0 disable altex5 output is disabled in idle phase 1 high altex5 output is high in idle phase 2 low altex5 output is low in idle phase 9:8 idleconf4 0x0 rw altex4 idle phase configuration value mode description 0 disable altex4 output is disabled in idle phase 1 high altex4 output is high in idle phase 2 low altex4 output is low in idle phase 7:6 idleconf3 0x0 rw altex3 idle phase configuration value mode description 0 disable altex3 output is disabled in idle phase 1 high altex3 output is high in idle phase 2 low altex3 output is low in idle phase 5:4 idleconf2 0x0 rw altex2 idle phase configuration value mode description 0 disable altex2 output is disabled in idle phase 1 high altex2 output is high in idle phase 2 low altex2 output is low in idle phase 3:2 idleconf1 0x0 rw altex1 idle phase configuration value mode description 0 disable altex1 output is disabled in idle phase 1 high altex1 output is high in idle phase 2 low altex1 output is low in idle phase 1:0 idleconf0 0x0 rw altex0 idle phase configuration
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 647 www.energymicro.com bit name reset access description value mode description 0 disable altex0 output is disabled in idle phase 1 high altex0 output is high in idle phase 2 low altex0 output is low in idle phase 25.5.17 lesense_if - interrupt flag register offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access r r r r r r r r r r r r r r r r r r r r r r r name cntof bufof buflevel bufdatav decerr dec scancomplete ch15 ch14 ch13 ch12 ch11 ch10 ch9 ch8 ch7 ch6 ch5 ch4 ch3 ch2 ch1 ch0 bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 cntof 0 r set when the lesense counter overflows. 21 bufof 0 r set when the result buffer overflows 20 buflevel 0 r set when the data buffer is full. 19 bufdatav 0 r set when data is available in the result buffer. 18 decerr 0 r set when the decoder detects an error 17 dec 0 r set when the decoder has issued and interrupt request 16 scancomplete 0 r set when a scan sequence is completed 15 ch15 0 r set when channel 15 triggers 14 ch14 0 r set when channel 14 triggers 13 ch13 0 r set when channel 13 triggers 12 ch12 0 r set when channel 12 triggers 11 ch11 0 r set when channel 11 triggers 10 ch10 0 r set when channel 10 triggers 9 ch9 0 r set when channel 9 triggers
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 648 www.energymicro.com bit name reset access description 8 ch8 0 r set when channel 8 triggers 7 ch7 0 r set when channel 7 triggers 6 ch6 0 r set when channel 6 triggers 5 ch5 0 r set when channel 5 triggers 4 ch4 0 r set when channel 4 triggers 3 ch3 0 r set when channel 3 triggers 2 ch2 0 r set when channel 2 triggers 1 ch1 0 r set when channel 1 triggers 0 ch0 0 r set when channel 0 triggers 25.5.18 lesense_ifc - interrupt flag clear register offset bit position 0x044 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name cntof bufof buflevel bufdatav decerr dec scancomplete ch15 ch14 ch13 ch12 ch11 ch10 ch9 ch8 ch7 ch6 ch5 ch4 ch3 ch2 ch1 ch0 bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 cntof 0 w1 write to 1 to clear cntof interrupt flag 21 bufof 0 w1 write to 1 to clear bufof interrupt flag 20 buflevel 0 w1 write to 1 to clear buflevel interrupt flag 19 bufdatav 0 w1 write to 1 to clear bufdatav interrupt flag 18 decerr 0 w1 write to 1 to clear decerr interrupt flag 17 dec 0 w1 write to 1 to clear dec interrupt flag 16 scancomplete 0 w1
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 649 www.energymicro.com bit name reset access description write to 1 to clear scancomplete interrupt flag 15 ch15 0 w1 write to 1 to clear ch15 interrupt flag 14 ch14 0 w1 write to 1 to clear ch14 interrupt flag 13 ch13 0 w1 write to 1 to clear ch13 interrupt flag 12 ch12 0 w1 write to 1 to clear ch12 interrupt flag 11 ch11 0 w1 write to 1 to clear ch11 interrupt flag 10 ch10 0 w1 write to 1 to clear ch10 interrupt flag 9 ch9 0 w1 write to 1 to clear ch9 interrupt flag 8 ch8 0 w1 write to 1 to clear ch8 interrupt flag 7 ch7 0 w1 write to 1 to clear ch7 interrupt flag 6 ch6 0 w1 write to 1 to clear ch6 interrupt flag 5 ch5 0 w1 write to 1 to clear ch5 interrupt flag 4 ch4 0 w1 write to 1 to clear ch4 interrupt flag 3 ch3 0 w1 write to 1 to clear ch3 interrupt flag 2 ch2 0 w1 write to 1 to clear ch2 interrupt flag 1 ch1 0 w1 write to 1 to clear ch1 interrupt flag 0 ch0 0 w1 write to 1 to clear ch0 interrupt flag 25.5.19 lesense_ifs - interrupt flag set register offset bit position 0x048 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 w1 name cntof bufof buflevel bufdatav decerr dec scancomplete ch15 ch14 ch13 ch12 ch11 ch10 ch9 ch8 ch7 ch6 ch5 ch4 ch3 ch2 ch1 ch0
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 650 www.energymicro.com bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 cntof 0 w1 write to 1 to set the cntof interrupt flag 21 bufof 0 w1 write to 1 to set the bufof interrupt flag 20 buflevel 0 w1 write to 1 to set the buflevel interrupt flag 19 bufdatav 0 w1 write to 1 to set the bufdatav interrupt flag 18 decerr 0 w1 write to 1 to set the decerr interrupt flag 17 dec 0 w1 write to 1 to set the dec interrupt flag 16 scancomplete 0 w1 write to 1 to set the scancomplete interrupt flag 15 ch15 0 w1 write to 1 to set the ch15 interrupt flag 14 ch14 0 w1 write to 1 to set the ch14 interrupt flag 13 ch13 0 w1 write to 1 to set the ch13 interrupt flag 12 ch12 0 w1 write to 1 to set the ch12 interrupt flag 11 ch11 0 w1 write to 1 to set the ch11 interrupt flag 10 ch10 0 w1 write to 1 to set the ch10 interrupt flag 9 ch9 0 w1 write to 1 to set the ch9 interrupt flag 8 ch8 0 w1 write to 1 to set the ch8 interrupt flag 7 ch7 0 w1 write to 1 to set the ch7 interrupt flag 6 ch6 0 w1 write to 1 to set the ch6 interrupt flag 5 ch5 0 w1 write to 1 to set the ch5 interrupt flag 4 ch4 0 w1 write to 1 to set the ch4 interrupt flag 3 ch3 0 w1 write to 1 to set the ch3 interrupt flag 2 ch2 0 w1 write to 1 to set the ch2 interrupt flag 1 ch1 0 w1 write to 1 to set the ch1 interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 651 www.energymicro.com bit name reset access description 0 ch0 0 w1 write to 1 to set the ch0 interrupt flag 25.5.20 lesense_ien - interrupt enable register offset bit position 0x04c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name cntof bufof buflevel bufdatav decerr dec scancomplete ch15 ch14 ch13 ch12 ch11 ch10 ch9 ch8 ch7 ch6 ch5 ch4 ch3 ch2 ch1 ch0 bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 cntof 0 rw set to enable interrupt on the cntof interrupt flag 21 bufof 0 rw set to enable interrupt on the bufof interrupt flag 20 buflevel 0 rw set to enable interrupt on the buflevel interrupt flag 19 bufdatav 0 rw set to enable interrupt on the bufdatav interrupt flag 18 decerr 0 rw set to enable interrupt on the decerr interrupt flag 17 dec 0 rw set to enable interrupt on the dec interrupt flag 16 scancomplete 0 rw set to enable interrupt on the scancomplete interrupt flag 15 ch15 0 rw set to enable interrupt on the ch15 interrupt flag 14 ch14 0 rw set to enable interrupt on the ch14 interrupt flag 13 ch13 0 rw set to enable interrupt on the ch13 interrupt flag 12 ch12 0 rw set to enable interrupt on the ch12 interrupt flag 11 ch11 0 rw set to enable interrupt on the ch11 interrupt flag 10 ch10 0 rw set to enable interrupt on the ch10 interrupt flag 9 ch9 0 rw set to enable interrupt on the ch9 interrupt flag 8 ch8 0 rw
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 652 www.energymicro.com bit name reset access description set to enable interrupt on the ch8 interrupt flag 7 ch7 0 rw set to enable interrupt on the ch7 interrupt flag 6 ch6 0 rw set to enable interrupt on the ch6 interrupt flag 5 ch5 0 rw set to enable interrupt on the ch5 interrupt flag 4 ch4 0 rw set to enable interrupt on the ch4 interrupt flag 3 ch3 0 rw set to enable interrupt on the ch3 interrupt flag 2 ch2 0 rw set to enable interrupt on the ch2 interrupt flag 1 ch1 0 rw set to enable interrupt on the ch1 interrupt flag 0 ch0 0 rw set to enable interrupt on the ch0 interrupt flag 25.5.21 lesense_syncbusy - synchronization busy register offset bit position 0x050 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access r r r r r r r r r r r r r r r r r r r r r r r r name eval interact timing data tconfb tconfa powerdown route altexconf idleconf sensorstate decstate curch bufdata ptr status scanres chen cmd biasctrl decctrl perctrl timctrl ctrl bit name reset access description 31:27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26 eval 0 r lesense_chx_eval register busy set when the value written to lesense_chx_eval is being synchronized. 25 interact 0 r lesense_chx_interact register busy set when the value written to lesense_chx_interact is being synchronized. 24 timing 0 r lesense_chx_timing register busy set when the value written to lesense_chx_timing is being synchronized. 23 data 0 r lesense_bufx_data register busy set when the value written to lesense_bufx_data is being synchronized. 22 tconfb 0 r lesense_stx_tconfb register busy set when the value written to lesense_stx_tconfb is being synchronized. 21 tconfa 0 r lesense_stx_tconfa register busy set when the value written to lesense_stx_tconfa is being synchronized. 20:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17 powerdown 0 r lesense_powerdown register busy set when the value written to lesense_powerdown is being synchronized.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 653 www.energymicro.com bit name reset access description 16 route 0 r lesense_route register busy set when the value written to lesense_route is being synchronized. 15 altexconf 0 r lesense_altexconf register busy set when the value written to lesense_altexconf is being synchronized. 14 idleconf 0 r lesense_idleconf register busy set when the value written to lesense_idleconf is being synchronized. 13 sensorstate 0 r lesense_sensorstate register busy set when the value written to lesense_sensorstate is being synchronized. 12 decstate 0 r lesense_decstate register busy set when the value written to lesense_decstate is being synchronized. 11 curch 0 r lesense_curch register busy set when the value written to lesense_curch is being synchronized. 10 bufdata 0 r lesense_bufdata register busy set when the value written to lesense_bufdata is being synchronized. 9 ptr 0 r lesense_ptr register busy set when the value written to lesense_ptr is being synchronized. 8 status 0 r lesense_status register busy set when the value written to lesense_status is being synchronized. 7 scanres 0 r lesense_scanres register busy set when the value written to lesense_scanres is being synchronized. 6 chen 0 r lesense_chen register busy set when the value written to lesense_chen is being synchronized. 5 cmd 0 r lesense_cmd register busy set when the value written to lesense_cmd is being synchronized. 4 biasctrl 0 r lesense_biasctrl register busy set when the value written to lesense_biasctrl is being synchronized. 3 decctrl 0 r lesense_decctrl register busy set when the value written to lesense_decctrl is being synchronized. 2 perctrl 0 r lesense_perctrl register busy set when the value written to lesense_perctrl is being synchronized. 1 timctrl 0 r lesense_timctrl register busy set when the value written to lesense_timctrl is being synchronized. 0 ctrl 0 r lesense_ctrl register busy set when the value written to lesense_ctrl is being synchronized. 25.5.22 lesense_route - i/o routing register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x054 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw name altex7pen altex6pen altex5pen altex4pen altex3pen altex2pen altex1pen altex0pen ch15pen ch14pen ch13pen ch12pen ch11pen ch10pen ch9pen ch8pen ch7pen ch6pen ch5pen ch4pen ch3pen ch2pen ch1pen ch0pen
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 654 www.energymicro.com bit name reset access description 31:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23 altex7pen 0 rw altex7 pin enable 22 altex6pen 0 rw altex6 pin enable 21 altex5pen 0 rw altex5 pin enable 20 altex4pen 0 rw altex4 pin enable 19 altex3pen 0 rw altex3 pin enable 18 altex2pen 0 rw altex2 pin enable 17 altex1pen 0 rw altex1 pin enable 16 altex0pen 0 rw altex0 pin enable 15 ch15pen 0 rw ch15 pin enable 14 ch14pen 0 rw ch14 pin enable 13 ch13pen 0 rw ch13 pin enable 12 ch12pen 0 rw ch12 pin enable 11 ch11pen 0 rw ch11 pin enable 10 ch10pen 0 rw ch10 pin enable 9 ch9pen 0 rw ch9 pin enable 8 ch8pen 0 rw ch8 pin enable 7 ch7pen 0 rw ch7 pin enable 6 ch6pen 0 rw ch6 pin enable 5 ch5pen 0 rw ch5 pin enable 4 ch4pen 0 rw ch4 pin enable 3 ch3pen 0 rw ch3 pin enable 2 ch2pen 0 rw ch2 pin enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 655 www.energymicro.com bit name reset access description 1 ch1pen 0 rw ch0 pin enable 0 ch0pen 0 rw ch0 pin enable 25.5.23 lesense_powerdown - lesense ram power-down register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x058 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name ram bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 ram 0 rw lesense ram power-down shut off power to the lesense ram. once it is powered down, it cannot be powered up again 25.5.24 lesense_stx_tconfa - state transition configuration a (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x200 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset x x 0xx 0xx 0xx 0xx access rw rw rw rw rw rw name chain setif prsact nextstate mask comp bit name reset access description 31:19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18 chain x rw enable state descriptor chaining when set, descriptor in the next location will also be evaluated 17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 setif x rw set interrupt flag enable set interrupt flag when sensor state equals comp
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 656 www.energymicro.com bit name reset access description 15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14:12 prsact 0xx rw configure transition action configure which action to perform when sensor state equals comp decctrl_prscnt = 0 mode value description none 0 no prs pulses generated prs0 1 generate pulse on lesprs0 prs1 2 generate pulse on lesprs1 prs01 3 generate pulse on lesprs0 and lesprs1 prs2 4 generate pulse on lesprs2 prs02 5 generate pulse on lesprs0 and lesprs2 prs12 6 generate pulse on lesprs1 and lesprs2 prs012 7 generate pulse on lesprs0, lesprs1 and lesprs2 decctrl_prscnt = 1 none 0 do not count up 1 count up down 2 count down prs2 4 generate pulse on lesprs2 upandprs2 5 count up and generate pulse on lesprs2. downandprs2 6 count down and generate pulse on lesprs2. 11:8 nextstate 0xx rw next state index index of next state to be entered if the sensor state equals comp 7:4 mask 0xx rw sensor mask set bit x to exclude sensor x from evaluation. 3:0 comp 0xx rw sensor compare value state transition is triggered when sensor state equals comp 25.5.25 lesense_stx_tconfb - state transition configuration b (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x204 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset x 0xx 0xx 0xx 0xx access rw rw rw rw rw name setif prsact nextstate mask comp bit name reset access description 31:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 setif x rw set interrupt flag set interrupt flag when sensor state equals comp 15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14:12 prsact 0xx rw configure transition action configure which action to perform when sensor state equals comp
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 657 www.energymicro.com bit name reset access description decctrl_prscnt = 0 mode value description none 0 no prs pulses generated prs0 1 generate pulse on prs0 prs1 2 generate pulse on prs1 prs01 3 generate pulse on prs0 and prs1 prs2 4 generate pulse on prs2 prs02 5 generate pulse on prs0 and prs2 prs12 6 generate pulse on prs1 and prs2 prs012 7 generate pulse on prs0, prs1 and prs2 decctrl_prscnt = 1 none 0 do not count up 1 count up down 2 count down prs2 4 generate pulse on prs2 upandprs2 5 count up and generate pulse on prs2. downandprs2 6 count down and generate pulse on prs2. 11:8 nextstate 0xx rw next state index index of next state to be entered if the sensor state equals comp 7:4 mask 0xx rw sensor mask set bit x to exclude sensor x from evaluation. 3:0 comp 0xx rw sensor compare value state transition is triggered when sensor state equals comp 25.5.26 lesense_bufx_data - scan results (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x280 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxxxx access rw name data bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 data 0xxxxx rw scan result buffer 25.5.27 lesense_chx_timing - scan configuration (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 658 www.energymicro.com offset bit position 0x2c0 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xxx 0xxx 0xxx access rw rw rw name measuredly sampledly extime bit name reset access description 31:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19:13 measuredly 0xxx rw set measure delay configure measure delay. sensor measuring is delayed for measuredly+1 exclk cycles. 12:6 sampledly 0xxx rw set sample delay configure sample delay. sampling will occur after sampledly+1 sampleclk cycles. 5:0 extime 0xxx rw set excitation time configure excitation time. excitation will last extime+1 exclk cycles. 25.5.28 lesense_chx_interact - scan configuration (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x2c4 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset x x x 0xx 0xx x 0xxxx access rw rw rw rw rw rw rw name altex sampleclk exclk exmode setif sample acmpthres bit name reset access description 31:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19 altex x rw use alternative excite pin if set, alternative excite pin will be used for excitation 18 sampleclk x rw select clock used for timing of sample delay value mode description 0 lfaclk lfaclk will be used for timing 1 auxhfrco auxhfrco will be used for timing 17 exclk x rw select clock used for excitation timing value mode description 0 lfaclk lfaclk will be used for timing 1 auxhfrco auxhfrco will be used for timing
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 659 www.energymicro.com bit name reset access description 16:15 exmode 0xx rw set gpio mode gpio mode for the excitation phase of the scan sequence. note that dacout is only available on channels 0, 1, 2, 3, 12, 13, 14, and 15. value mode description 0 disable disabled 1 high push pull, gpio is driven high 2 low push pull, gpio is driven low 3 dacout dac output 14:13 setif 0xx rw enable interrupt generation select interrupt generation mode for chx interrupt flag. value mode description 0 none no interrupt is generated 1 level set interrupt flag if the sensor triggers. 2 posedge set interrupt flag on positive edge on the sensor state 3 negedge set interrupt flag on negative edge on the sensor state 12 sample x rw select sample mode select if acmp output or counter output should be used in comparison value mode description 0 counter counter output will be used in comparison 1 acmp acmp output will be used in comparison 11:0 acmpthres 0xxxx rw set acmp threshold select acmp threshold. 25.5.29 lesense_chx_eval - scan configuration (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x2c8 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset x x x x 0xxxxx access rw rw rw rw rw name scanresinv strsample decode comp compthres bit name reset access description 31:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19 scanresinv x rw enable inversion of result if set, the bit stored in scanres will be inverted. 18 strsample x rw select if counter result should be stored if set, the counter value will be stored and available in the result buffer 17 decode x rw send result to decoder if set, the result from this channel will be shifted into the decoder register. 16 comp x rw select mode for counter comparison set compare mode
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 660 www.energymicro.com bit name reset access description ch_interact_sample = counter mode value description less 0 comparison evaluates to 1 if counter value is less than compthres. ge 1 comparison evaluates to 1 if counter value is greater than, or equal to compthres. ch_interact_sample = acmp less 0 comparison evaluates to 1 if the acmp output is 0. ge 1 comparison evaluates to 1 if the acmp output is 1. 15:0 compthres 0xxxxx rw decision threshold for counter set counter threshold
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 661 www.energymicro.com 26 acmp - analog comparator 0 1 2 3 4 quick facts what? the acmp (analog comparator) compares two analog signals and returns a digital value telling which is greater. why? applications often do not need to know the exact value of an analog signal, only if it has passed a certain threshold. often the voltage must be monitored continuously, which requires extremely low power consumption. how? available down to energy mode 3 and using as little as 100 na, the acmp can wake up the system when input signals pass the threshold. the analog comparator can compare two analog signals or one analog signal and a highly configurable internal reference. 26.1 introduction the analog comparator is used to compare the voltage of two analog inputs, with a digital output indicating which input voltage is higher. inputs can either be one of the selectable internal references or from external pins. response time and thereby also the current consumption can be configured by altering the current supply to the comparator. 26.2 features ? 8 selectable external positive inputs ? 8 selectable external negative inputs ? 5 selectable internal negative inputs ? internal 1.25 v bandgap ? internal 2.5 v bandgap ? v dd scaled by 64 selectable factors ? dac channel 0 and 1 ? low power mode for internal v dd and bandgap references ? selectable hysteresis ? 8 levels between 0 and 70 mv ? selectable response time ? asynchronous interrupt generation on selectable edges ? rising edge ? falling edge ? both edges ? operational in em0-em3 ? dedicated capacitive sense mode with up to 8 inputs ? adjustable internal resistor ? configurable inversion of comparator output
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 662 www.energymicro.com ? configurable output when inactive ? comparator output direct on prs ? comparator output on gpio through alternate functionality ? output inversion available 26.3 functional description an overview of the acmp is shown in figure 26.1 (p. 662 ) . figure 26.1. acmp overview scaler 1.25 v 2.5 v acmpn_ch7 acmpn_ch0 acmpn_ch6 acmpn_ch5 acmpn_ch4 acmpn_ch3 acmpn_ch2 acmpn_ch1 out put t o prs out put t o gpio vddlevel negsel possel biasprog hystsel en acmpact acmpout inactval warm -up count er gpioinv 000 - 111 0000 - 1101 v dd 1 0 read only regist ers read/writ e regist ers lpref edge int errupt warm up int errupt halfbias fullbias v dd _ scaled dac0_ch0 dac0_ch1 the comparator has two analog inputs, one positive and one negative. when the comparator is active, the output indicates which of the two input voltages is higher. when the voltage on the positive input is higher than the voltage on the negative input, the digital output is high and vice versa. the output of the comparator can be read in the acmpout bit in acmpn_status. it is possible to switch inputs while the comparator is enabled, but all other configuration should only be changed while the comparator is disabled. 26.3.1 warm-up time the analog comparator is enabled by setting the en bit in acmpn_ctrl. when this bit is set, the comparator must stabilize before becoming active and the outputs can be used. this time period is called the warm-up time. the warm-up time is a configurable number of peripheral clock (hfperclk) cycles, set in warmtime, which should be set to at least 10 s but lengthens to up to 1ms if lpref is enabled. the acmp should always start in active mode and then enable the lpref after warm-up time. when the comparator is enabled and warmed up, the acmpact bit in acmpn_status will indicate that the comparator is active. the output value when the comparator is inactive is set to the value in inactval in acmpn_ctrl (see figure 26.1 (p. 662 ) ). an edge interrupt will be generated after the warm-up time if edge interrupt is enabled and the value set in inactval is different from acmpout after warm-up. one should wait until the warm-up period is over before entering em2 or em3, otherwise no comparator interrupts will be detected. em1 can still be entered during warm-up. after the warm-up period is completed, interrupts will be detected in em2 and em3.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 663 www.energymicro.com 26.3.2 response time there is a delay from when the actual input voltage changes polarity, to when the output toggles. this period is called the response time and can be altered by increasing or decreasing the bias current to the comparator through the biasprog, fullbiasprog and halfbias fields in the acmpn_ctrl register, as described in table 26.1 (p. 663 ) .setting the halfbias bit in acmpn_ctrl effectively halves the current as observed in table 26.1 (p. 663 ) . setting a lower bias current will result in lower power consumption, but a longer response time. if the fullbias bit is set, the highest hysteresis level should be used to avoid glitches on the output. table 26.1. bias configuration bias current (a) biasprog fullbias=0, halfbias=1 fullbias=0, halfbias=0 fullbias=1, halfbias=1 fullbias=1, halfbias=0 0b0000 0.05 0.1 3.3 6.5 0b0001 0.1 0.2 6.5 13 0b0010 0.2 0.4 13 26 0b0011 0.3 0.6 20 39 0b0100 0.4 0.8 26 52 0b0101 0.5 1.0 33 65 0b0110 0.6 1.2 39 78 0b0111 0.7 1.4 46 91 0b1000 1.0 2.0 65 130 0b1001 1.1 2.2 72 143 0b1010 1.2 2.4 78 156 0b1011 1.3 2.6 85 169 0b1100 1.4 2.8 91 182 0b1101 1.5 3.0 98 195 0b1110 1.6 3.2 104 208 0b1111 1.7 3.4 111 221 26.3.3 hysteresis in the analog comparator, hysteresis can be configured to 8 different levels, including off which is level 0, through the hystsel field in acmpn_ctrl. when the hysteresis level is set above 0, the digital output will not toggle until the positive input voltage is at a voltage equal to the hysteresis level above or below the negative input voltage (see figure 26.2 (p. 664 ) ). this feature can be used to filter out uninteresting input fluctuations around zero and only show changes that are big enough to breach the hysteresis threshold.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 664 www.energymicro.com figure 26.2. 20 mv hysteresis selected in neg acmpout wit h hyst eresis in neg + 20m v in neg - 20m v acmpout wit hout hyst eresis tim e in pos 26.3.4 input selection the possel and negsel fields in acmpn_inputsel controls which signals are connected to the two inputs of the comparator. 8 external pins are available for both the negative and positive input. for the negative input, 5 additional internal reference sources are available; 1.25 v bandgap, 2.5v bandgap, dac channel 0, dac channel 1, and v dd . the v dd reference can be scaled by a configurable factor, which is set in vddlevel (in acmpn_inputsel) according to the following formula: v dd scaled v dd_scaled = v dd vddlevel/63 (26.1) a low power reference mode can be enabled by setting the lpref bit in acmpn_inputsel. in this mode, the power consumption in the reference buffer (v dd and bandgap) is lowered at the cost of accuracy. low power mode will only save power if v dd with vddlevel higher than 0 or a bandgap reference is selected. normally the analog comparator input mux is disabled when the en (in acmpn_ctrl) bit is set low. however if the muxen bit in acmpn_ctrl is set, the mux is enabled regardless of the en bit. this will minimize kickback noise on the mux inputs when the en bit is toggled. 26.3.5 capacitive sense mode the analog comparator includes specialized hardware for capacitive sensing of passive push buttons. such buttons are traces on pcb laid out in a way that creates a parasitic capacitor between the button and the ground node. because a human finger will have a small intrinsic capacitance to ground, the capacitance of the button will increase when the button is touched. the capacitance is measured by including the capacitor in a free-running rc oscillator (see figure 26.3 (p. 665 ) ). the frequency produced will decrease when the button is touched compared to when it is not touched. by measuring the output frequency with a timer (e.g. through prs), the change in capacitance can be calculated. the analog comparator contains a complete feedback loop including an optional internal resistor. this resistor is enabled by setting the csresen bit in acmpn_inputsel. the resistance can be set to one of four values by configuring the csressel bits in acmpn_inputsel. if the internal resistor is not enabled, the circuit will be open. the capacitive sense mode is enabled by setting the negsel field in acmpn_inputsel to capsense. the input pin is selected through the possel bits in acmpn_inputsel. the scaled v dd in figure 26.3 (p. 665 ) can be altered by configuring the vddlevel in acmpn_inputsel. it is recommended to set the hysteresis (hystsel in acmpn_ctrl) higher than the lowest level when using the analog comparator in capacitive sense mode.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 665 www.energymicro.com figure 26.3. capacitive sensing set-up v dd / 4 v dd _ scaled but t ons possel 26.3.6 interrupts and prs output the analog comparator includes an edge triggered interrupt flag (edge in acmpn_if). if either irise and/or ifall in acmpn_ctrl is set, the edge interrupt flag will be set on rising and/or falling edge of the comparator output, respectively. an interrupt request will be sent if the edge interrupt flag in acmpn_if is set and enabled through the edge bit in acmpn_ien. the edge interrupt can also be used to wake up the device from em3-em1. the analog comparator also includes an interrupt flag, warmup in acmpn_if, which is set when a warm-up sequence has finished. an interrupt request will be sent if the warmup interrupt flag in acmpn_if is set and enabled through the warmup bit in acmpn_ien. the comparator output is also available as a prs signal. 26.3.7 output to gpio the output from the comparator is available as alternate function to the gpio pins. set the acmppen bit in acmpn_route to enable output to pin, and the location bits to select output location. the gpio-pin must also be set as output. the output to the gpio can be inverted by setting the gpioinv bit in acmpn_ctrl.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 666 www.energymicro.com 26.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 acmpn_ctrl rw control register 0x004 acmpn_inputsel rw input selection register 0x008 acmpn_status r status register 0x00c acmpn_ien rw interrupt enable register 0x010 acmpn_if r interrupt flag register 0x014 acmpn_ifs w1 interrupt flag set register 0x018 acmpn_ifc w1 interrupt flag clear register 0x01c acmpn_route rw i/o routing register 26.5 register description 26.5.1 acmpn_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 1 0x7 0 0 0x0 0x0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw name fullbias halfbias biasprog ifall irise warmtime hystsel gpioinv inactval muxen en bit name reset access description 31 fullbias 0 rw full bias current set this bit to 1 for full bias current in accordance with. table 26.1 (p. 663 ) . 30 halfbias 1 rw half bias current set this bit to 1 to halve the bias current in accordance with. table 26.1 (p. 663 ) . 29:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27:24 biasprog 0x7 rw bias configuration these bits control the bias current level in accordance with. table 26.1 (p. 663 ) . 23:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17 ifall 0 rw falling edge interrupt sense set this bit to 1 to set the edge interrupt flag on falling edges of comparator output. value mode description 0 disabled interrupt flag is not set on falling edges. 1 enabled interrupt flag is set on falling edges. 16 irise 0 rw rising edge interrupt sense set this bit to 1 to set the edge interrupt flag on rising edges of comparator output. value mode description 0 disabled interrupt flag is not set on rising edges. 1 enabled interrupt flag is set on rising edges. 15:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 warmtime 0x0 rw warm-up time set analog comparator warm-up time.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 667 www.energymicro.com bit name reset access description value mode description 0 4cycles 4 hfperclk cycles. 1 8cycles 8 hfperclk cycles. 2 16cycles 16 hfperclk cycles. 3 32cycles 32 hfperclk cycles. 4 64cycles 64 hfperclk cycles. 5 128cycles 128 hfperclk cycles. 6 256cycles 256 hfperclk cycles. 7 512cycles 512 hfperclk cycles. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:4 hystsel 0x0 rw hysteresis select select hysteresis level. the hysteresis levels can vary, please see the electrical characteristics for the device for more information. value mode description 0 hyst0 no hysteresis. 1 hyst1 ~15 mv hysteresis. 2 hyst2 ~22 mv hysteresis. 3 hyst3 ~29 mv hysteresis. 4 hyst4 ~36 mv hysteresis. 5 hyst5 ~43 mv hysteresis. 6 hyst6 ~50 mv hysteresis. 7 hyst7 ~57 mv hysteresis. 3 gpioinv 0 rw comparator gpio output invert set this bit to 1 to invert the comparator alternate function output to gpio. value mode description 0 notinv the comparator output to gpio is not inverted. 1 inv the comparator output to gpio is inverted. 2 inactval 0 rw inactive value the value of this bit is used as the comparator output when the comparator is inactive. value mode description 0 low the inactive value is 0. 1 high the inactive state is 1. 1 muxen 0 rw input mux enable enable input mux. setting the en bit will also enable the input mux. 0 en 0 rw analog comparator enable enable/disable analog comparator. 26.5.2 acmpn_inputsel - input selection register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 1 0x00 0x8 0x0 access rw rw rw rw rw rw name csressel csresen lpref vddlevel negsel possel bit name reset access description 31:30 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 668 www.energymicro.com bit name reset access description 29:28 csressel 0x0 rw capacitive sense mode internal resistor select these bits select the resistance value for the internal capacitive sense resistor. resulting actual resistor values are given in the device datasheets. value mode description 0 res0 internal capacitive sense resistor value 0. 1 res1 internal capacitive sense resistor value 1. 2 res2 internal capacitive sense resistor value 2. 3 res3 internal capacitive sense resistor value 3. 27:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24 csresen 0 rw capacitive sense mode internal resistor enable enable/disable the internal capacitive sense resistor. 23:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 lpref 1 rw low power reference mode enable low power mode for vdd and bandgap references. value description 0 low power mode disabled. 1 low power mode enabled. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 vddlevel 0x00 rw vdd reference level select scaling factor for vdd reference level.v dd_scaled = v dd vddlevel/63. 7:4 negsel 0x8 rw negative input select select negative input. value mode description 0 ch0 channel 0 as negative input. 1 ch1 channel 1 as negative input. 2 ch2 channel 2 as negative input. 3 ch3 channel 3 as negative input. 4 ch4 channel 4 as negative input. 5 ch5 channel 5 as negative input. 6 ch6 channel 6 as negative input. 7 ch7 channel 7 as negative input. 8 1v25 1.25 v as negative input. 9 2v5 2.5 v as negative input. 10 vdd scaled vdd as negative input. 11 capsense capacitive sense mode. 12 dac0ch0 dac0 channel 0. 13 dac0ch1 dac0 channel 1. 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2:0 possel 0x0 rw positive input select select positive input. value mode description 0 ch0 channel 0 as positive input. 1 ch1 channel 1 as positive input. 2 ch2 channel 2 as positive input. 3 ch3 channel 3 as positive input. 4 ch4 channel 4 as positive input. 5 ch5 channel 5 as positive input. 6 ch6 channel 6 as positive input. 7 ch7 channel 7 as positive input.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 669 www.energymicro.com 26.5.3 acmpn_status - status register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access r r name acmpout acmpact bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 acmpout 0 r analog comparator output analog comparator output value. 0 acmpact 0 r analog comparator active analog comparator active status. 26.5.4 acmpn_ien - interrupt enable register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access rw rw name warmup edge bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 warmup 0 rw warm-up interrupt enable enable/disable interrupt on finished warm-up. 0 edge 0 rw edge trigger interrupt enable enable/disable edge triggered interrupt. 26.5.5 acmpn_if - interrupt flag register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access r r name warmup edge
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 670 www.energymicro.com bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 warmup 0 r warm-up interrupt flag indicates that the analog comparator warm-up period is finished. 0 edge 0 r edge triggered interrupt flag indicates that there has been a rising or falling edge on the analog comparator output. 26.5.6 acmpn_ifs - interrupt flag set register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name warmup edge bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 warmup 0 w1 warm-up interrupt flag set write to 1 to set warm-up finished interrupt flag. 0 edge 0 w1 edge triggered interrupt flag set write to 1 to set edge triggered interrupt flag. 26.5.7 acmpn_ifc - interrupt flag clear register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name warmup edge bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 warmup 0 w1 warm-up interrupt flag clear write to 1 to clear warm-up finished interrupt flag. 0 edge 0 w1 edge triggered interrupt flag clear write to 1 to clear edge triggered interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 671 www.energymicro.com 26.5.8 acmpn_route - i/o routing register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 access rw rw name location acmppen bit name reset access description 31:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 location 0x0 rw i/o location decides the location of the acmp i/o pin. value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 7:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 acmppen 0 rw acmp output pin enable enable/disable analog comparator output to pin.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 672 www.energymicro.com 27 vcmp - voltage comparator 0 1 2 3 4 int errupt s v dd > x ? bat t ery v dd < x ? vcmp v dd gnd quick facts what? the voltage supply comparator (vcmp) monitors the input voltage supply and generates software interrupts on events using as little as 100 na. why? the vcmp can be used for simple power supply monitoring, e.g. for a battery level indicator. how? the scaled power supply is compared to a programmable reference voltage, and an interrupt can be generated when the supply is higher or lower than the reference. the vcmp can also be duty-cycled by software to further reduce the energy consumption. 27.1 introduction the voltage supply comparator is used to monitor the supply voltage from software. an interrupt can be generated when the supply falls below or rises above a programmable threshold. note note that vcmp comes in addition to the power-on reset and brown-out detector peripherals, that both generate reset signals when the voltage supply is insufficient for reliable operation. vcmp does not generate reset, only interrupt. also note that the adc is capable of sampling the input voltage supply. 27.2 features ? voltage supply monitoring ? scalable v dd in 64 steps selectable as positive comparator input ? internal 1.25 v bandgap reference ? low power mode for internal v dd and bandgap references ? selectable hysteresis ? 0 or 20 mv ? selectable response time ? asynchronous interrupt generation on selectable edges ? rising edge ? falling edge ? rising and falling edges ? operational in em0-em3 ? comparator output direct on prs ? configurable output when inactive to avoid unwanted interrupts
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 673 www.energymicro.com 27.3 functional description an overview of the vcmp is shown in figure 27.1 (p. 673 ) . figure 27.1. vcmp overview 1.25v biasprog hysten en warm -up count er read only regist er read/writ e regist ers lpref scaler triglevel v dd vcmpact vcmpout inactval 1 0 edge int errupt warm up int errupt prs halfbias the comparator has two analog inputs, one positive and one negative. when the comparator is active, the output indicates which of the two input voltages is higher. when the voltage on the positive input is higher than the negative input voltage, the digital output is high and vice versa. the output of the comparator can be read in the vcmpout bit in vcmp_status. configuration registers should only be changed while the comparator is disabled. 27.3.1 warm-up time vcmp is enabled by setting the en bit in vcmp_ctrl. when this bit is set, the comparator must stabilize before becoming active and the outputs can be used. this time period is called the warm-up time. the warm-up time is a configurable number of hfperclk cycles, set in warmtime, which should be set to at least 10 s. when the comparator is enabled and warmed up, the vcmpact bit in vcmp_status will be set to indicate that the comparator is active. as long as the comparator is not enabled or not warmed up, vcmpact will be cleared and the comparator output value is set to the value in inactval in vcmp_ctrl. one should wait until the warm-up period is over before entering em2 or em3, otherwise no comparator interrupts will be detected. em1 can still be entered during warm-up. after the warm-up period is completed, interrupts will be detected in em2 and em3. 27.3.2 response time there is a delay from when the actual input voltage changes polarity, to when the output toggles. this period is called the response time and can be altered by increasing or decreasing the bias current to the comparator through the bias and halfbias fields in vcmp_ctrl as shown in table 27.1 (p. 673 ) . setting a lower bias current will result in lower power consumption, but a longer response time. table 27.1. bias configuration bias current (a) bias halfbias=0 halfbias=1 0b0000 0.1 0.05 0b0001 0.2 0.1 0b0010 0.4 0.2 0b0011 0.6 0.3 0b0100 0.8 0.4 0b0101 1.0 0.5
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 674 www.energymicro.com bias current (a) bias halfbias=0 halfbias=1 0b0110 1.2 0.6 0b0111 1.4 0.7 0b1000 2.0 1.0 0b1001 2.2 1.1 0b1010 2.4 1.2 0b1011 2.6 1.3 0b1100 2.8 1.4 0b1101 3.0 1.5 0b1110 3.2 1.6 0b1111 3.4 1.7 27.3.3 hysteresis in the voltage supply comparator, hysteresis can be enabled by setting hysten in vcmp_ctrl. when hysten is set, the digital output will not toggle until the positive input voltage is at least 20mv above or below the negative input voltage. this feature can be used to filter out uninteresting input fluctuations around zero and only show changes that are big enough to breach the hysteresis threshold. figure 27.2. vcmp 20 mv hysteresis enabled in neg vcmpout wit h hyst eresis in neg + 20m v in neg - 20m v vcmpout wit hout hyst eresis tim e in pos 27.3.4 input selection the positive comparator input is always connected to the scaled power supply input. the negative comparator input is connected to the internal 1.25 v bandgap reference. the v dd trigger level can be configured by setting the triglevel field in vcmp_ctrl according to the following formula: vcmp v dd trigger level v dd trigger level = 1.667v + 0.034v triglevel (27.1) a low power reference mode can be enabled by setting the lpref bit in vcmp_inputsel. in this mode, the power consumption in the reference buffer (v dd and bandgap) is lowered at the cost of accuracy. 27.3.5 interrupts and prs output the vcmp includes an edge triggered interrupt flag (edge in vcmp_if). if either irise and/or ifall in vcmpn_ctrl is set, the edge interrupt flag will be set on rising and/or falling edge of the comparator
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 675 www.energymicro.com output respectively. an interrupt request will be sent if the edge interrupt flag in vcmp_if is set and enabled through the edge bit in vcmpn_ien. the edge interrupt can also be used to wake up the device from em3-em1. vcmp also includes an interrupt flag, warmup in vcmp_if, which is set when a warm-up sequence has finished. an interrupt request will be sent if the warmup interrupt flag in vcmp_if is set and enabled through the warmup bit in vcmpn_ien. the synchronized comparator output is also available as a prs output signal.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 676 www.energymicro.com 27.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 vcmp_ctrl rw control register 0x004 vcmp_inputsel rw input selection register 0x008 vcmp_status r status register 0x00c vcmp_ien rw interrupt enable register 0x010 vcmp_if r interrupt flag register 0x014 vcmp_ifs w1 interrupt flag set register 0x018 vcmp_ifc w1 interrupt flag clear register 27.5 register description 27.5.1 vcmp_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 0x7 0 0 0x0 0 0 0 access rw rw rw rw rw rw rw rw name halfbias biasprog ifall irise warmtime hysten inactval en bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30 halfbias 1 rw half bias current set this bit to 1 to halve the bias current. table 27.1 (p. 673 ) . 29:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27:24 biasprog 0x7 rw vcmp bias programming value these bits control the bias current level. table 27.1 (p. 673 ) . 23:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17 ifall 0 rw falling edge interrupt sense set this bit to 1 to set the edge interrupt flag on falling edges of comparator output. 16 irise 0 rw rising edge interrupt sense set this bit to 1 to set the edge interrupt flag on rising edges of comparator output. 15:11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 warmtime 0x0 rw warm-up time set warm-up time value mode description 0 4cycles 4 hfperclk cycles 1 8cycles 8 hfperclk cycles 2 16cycles 16 hfperclk cycles 3 32cycles 32 hfperclk cycles 4 64cycles 64 hfperclk cycles 5 128cycles 128 hfperclk cycles 6 256cycles 256 hfperclk cycles
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 677 www.energymicro.com bit name reset access description value mode description 7 512cycles 512 hfperclk cycles 7:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 hysten 0 rw hysteresis enable enable hysteresis. value description 0 no hysteresis 1 +-20 mv hysteresis 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 inactval 0 rw inactive value configure the output value when the comparator is inactive. 1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 en 0 rw voltage supply comparator enable enable/disable voltage supply comparator. 27.5.2 vcmp_inputsel - input selection register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x00 access rw rw name lpref triglevel bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 lpref 0 rw low power reference enable/disable low power mode for vdd and bandgap reference. when using this bit, always leave it as 0 during warm-up and then set it to 1 if desired when the warm-up is done. 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:0 triglevel 0x00 rw trigger level select vdd trigger level. v trig = 1.667v+0.034vtriglevel. 27.5.3 vcmp_status - status register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access r r name vcmpout vcmpact
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 678 www.energymicro.com bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 vcmpout 0 r voltage supply comparator output voltage supply comparator output value 0 vcmpact 0 r voltage supply comparator active voltage supply comparator active status. 27.5.4 vcmp_ien - interrupt enable register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access rw rw name warmup edge bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 warmup 0 rw warm-up interrupt enable enable/disable interrupt on finished warm-up. 0 edge 0 rw edge trigger interrupt enable enable/disable edge triggered interrupt. 27.5.5 vcmp_if - interrupt flag register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access r r name warmup edge bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 warmup 0 r warm-up interrupt flag indicates that warm-up has finished. 0 edge 0 r edge triggered interrupt flag indicates that there has been a rising and/or falling edge on the vcmp output.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 679 www.energymicro.com 27.5.6 vcmp_ifs - interrupt flag set register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name warmup edge bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 warmup 0 w1 warm-up interrupt flag set write to 1 to set warm-up finished interrupt flag 0 edge 0 w1 edge triggered interrupt flag set write to 1 to set edge triggered interrupt flag 27.5.7 vcmp_ifc - interrupt flag clear register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name warmup edge bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 warmup 0 w1 warm-up interrupt flag clear write to 1 to clear warm-up finished interrupt flag 0 edge 0 w1 edge triggered interrupt flag clear write to 1 to clear edge triggered interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 680 www.energymicro.com 28 adc - analog to digital converter 0 1 2 3 4 adc ...0101110... + - quick facts what? the adc is used to convert analog signals into a digital representation and features 8 external input channels why? in many applications there is a need to measure analog signals and record them in a digital representation, without exhausting your energy source. how? a low power successive approximation register adc samples up to 8 input channels in a programmable sequence. with the help of prs and dma, the adc can operate without cpu intervention, minimizing the number of powered up resources. the adc can further be duty-cycled to reduce the energy consumption. 28.1 introduction the adc is a successive approximation register (sar) architecture, with a resolution of up to 12 bits at up to one million samples per second. the integrated input mux can select inputs from 8 external pins and 6 internal signals. 28.2 features ? programmable resolution (6/8/12-bit) ? 13 prescaled clock (adc_clk) cycles per conversion ? maximum 1 msps @ 12-bit ? maximum 1.86 msps @ 6-bit ? configurable acquisition time ? integrated prescaler ? selectable clock division factor from 1 to 128 ? 13 mhz to 32 khz allowed for adc_clk ? 18 input channels ? 8 external single ended channels ? 6 internal single ended channels ? including temperature sensor ? 4 external differential channels ? integrated input filter ? low pass rc filter ? decoupling capacitor ? left or right adjusted results ? results in 2?s complement representation ? differential results sign extended to 32-bit results
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 681 www.energymicro.com ? programmable scan sequence ? up to 8 configurable samples in scan sequence ? mask to select which pins are included in the sequence ? triggered by software or prs input ? one shot or repetitive mode ? oversampling available ? overflow interrupt flag set when overwriting unread results ? conversion tailgating support for predictable periodic scans ? programmable single conversion ? triggered by software or prs input ? can be interleaved between two scan sequences ? one shot or repetitive mode ? oversampling available ? overflow interrupt flag set when overwriting unread results ? hardware oversampling support ? 1st order accumulate and dump filter ? from 2 to 4096 oversampling ratio (osr) ? results in 16-bit representation ? enabled individually for scan sequence and single sample mode ? common osr select ? individually selectable voltage reference for scan and single mode ? internal 1.25v reference ? internal 2.5v reference ? v dd ? internal 5 v differential reference ? single ended external reference ? differential external reference ? unbuffered 2xv dd ? support for offset and gain calibration ? interrupt generation and/or dma request ? finished single conversion ? finished scan conversion ? single conversion results overflow ? scan sequence results overflow ? loopback configuration with dac output measurement 28.3 functional description an overview of the adc is shown in figure 28.1 (p. 682 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 682 www.energymicro.com figure 28.1. adc overview sar adcn_ch 0 adcn_ch 7 tem p v ss v dd v dd / 3 dac 0 / opa 0 adcn_ch 1 adcn_ch 2 adcn_ch3 adcn_ch4 adcn_ch 5 adcn_ch 6 2.5 v 1.25 v v dd sequencer result buffer + - cont rol adcn_singledata adcn_scandata adcn_scanctrl adcn_ctrl adcn_singlectrl prescaler adc_clk hfperclk adcn dac 1 / opa 1 oversam pling filt er adcn_ cmd adcn_ status 2x(vdd-vss) 5 v different ial v ref / 2 28.3.1 clock selection the adc has an internal prescaler (presc bits in adcn_ctrl) which can divide the peripheral clock (hfperclk) by any factor between 1 and 128. note that the resulting adc_clk should not be set to a higher frequency than 13 mhz and not lower than 32 khz. 28.3.2 conversions a conversion consists of two phases. the input is sampled in the acquisition phase before it is converted to digital representation during the approximation phase. the acquisition time can be configured independently for scan and single conversions (see section 28.3.7 (p. 686 ) ) by setting at in adcn_singlectrl/adcn_scanctrl. the acquisition times can be set to any integer power of 2 from 1 to 256 adc_clk cycles. note for high impedance sources the acquisition time should be adjusted to allow enough time for the internal sample capacitor to fully charge. the minimum acquisition time for the internal temperature sensor and v dd /3 is given in the electrical characteristics for the device. the analog to digital converter core uses one clock cycle per output bit in the approximation phase. adc total conversion time (in adc_clk cycles) per output t conv = (t a +n) x osr (28.1) t a equals the number of acquisition cycles and n is the resolution. osr is the oversampling ratio (see section 28.3.7.7 (p. 688 ) ). the minimum conversion time is 7 adc_cycles with 6 bit resolution and 13 adc_cycles with 12 bit resolution. the maximum conversion time is 1097728 adc_cycles with the longest acquisition time, 12 bit resolution and highest oversampling rate.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 683 www.energymicro.com figure 28.2. adc conversion timing bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 singleat/ scanat 6-bit value ready 8-bit value ready 12-bit value ready hfperclk adcn prescaled clock (4x) adc act ion 28.3.3 warm-up time the adc needs to be warmed up some time before a conversion can take place. this time period is called the warm-up time. when enabling the adc or changing references between samples, the adc is automatically warmed up for 1s and an additional 5 s if the bandgap is selected as reference. normally, the adc will be warmed up only when samples are requested and is shut off when there are no more samples waiting. however, if lower latency is needed, configuring the warmupmode field in adcn_ctrl allows the adc and/or reference to stay warm between samples, eliminating the need for warm-up. figure 28.3 (p. 684 ) shows the analog power consumption in scenarios using the different warmupmode settings. only the bandgap reference selected for scan mode can be kept warm. if a different bandgap reference is selected for single mode, the warm-up time still applies. ? normal: adc and references are shut off when there are no samples waiting. a) in figure 28.3 (p. 684 ) shows this mode used with an internal bandgap reference. figure d) shows this mode when using vdd or an external reference. ? fastbg: bandgap warm-up is eliminated, but with reduced reference accuracy. d) in figure 28.3 (p. 684 ) shows this mode used with an internal bandgap reference. ? keepscanrefwarm: the reference selected for scan mode is kept warm. the adc will still need to be warmed up before conversion. b) in figure 28.3 (p. 684 ) shows this mode used with an internal bandgap reference. ? keepadcwarm: the adc and the reference selected for scan mode is kept warm. c) in figure 28.3 (p. 684 ) shows this mode used with an internal bandgap reference. the minimum warm-up times are given in s. the timing is done automatically by the adc, given that a proper time base is given in the timebase bits in adcn_ctrl. the timebase must be set to the number of hfperclk which corresponds to at least 1 s. the timebase only affects the timing of the warm-up sequence and not the adc_clk. when entering energy modes 2 or 3, the adc must be stopped and warmupmode in adcn_ctrl written to 0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 684 www.energymicro.com figure 28.3. adc analog power consumption with different warmupmode settings adc enabled conversion t rigger conversion t rigger power power power tim e tim e adc warm -up adc conversion bandgap reference warm -up 5 s 1 s 1 s 5 s 5 s 5 s n orm al keepscan refw arm ( w scan ref = in t e r n a l b a n d g a p ) keepad cw arm ( w scan ref = in t e r n a l b a n d g a p ) power tim e fastbg ( w scan ref = a n y ) or n orm al ( w scan ref = e xt e r n a l or v d d ) a) b) c) d) 28.3.4 input selection the adc is connected to 8 external input pins, which can be selected as 8 different single ended inputs or 4 differential inputs. in addition, 6 single ended internal inputs can be selected. the available selections are given in the register description for adcn_singlectrl and adcn_scanctrl. for offset calibration purposes it is possible to internally short the differential adc inputs and thereby measure a 0 v differential. differential 0 v is selected by writing the diff bit to 1 and inputsel to 4 in adcn_singlectrl. calibration is described in detail in section 28.3.10 (p. 689 ) . note when vdd/3 is sampled, the acquisition time should be above a lower limit. the reader is referred to the datasheet for minimum vdd/3 acquisition time. 28.3.4.1 input filtering the selected input signal can be filtered, either through an internal low pass rc filter or an internal decoupling capacitor. the different filter configurations can be enabled through the lpfmode bits in adcn_ctrl. the rc input filter configuration is given in figure 28.4 (p. 684 ) . the resistance and capacitance values are given in the electrical characteristics for the device, named r adcfilt and c adcfilt respectively. figure 28.4. adc rc input filter configuration adc input r c
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 685 www.energymicro.com 28.3.4.2 temperature measurement the adc includes an internal temperature sensor. this sensor is characterized during production and the temperature readout from the adc at production temperature, adc0_temp_0_read_1v25, is given in the device information (di) page. the production temperature, cal_temp_0, is also given in this page. the temperature gradient, tgrad_adcth (mv/degree celsius), for the sensor is found in the datasheet for the devices. by selecting 1.25 v internal reference and measuring the internal temperature sensor with 12 bit resolution, the temperature can be calculated according to the following formula: adc temperature measurement t celsius =cal_temp_0-(adc0_temp_0_read_1v25- adc_result)vref/(4096tgrad_adcth) (28.2) note the minimum acquisition time for the temperature reference is found in the electrical characteristics for the device. 28.3.5 reference selection the reference voltage can be selected from these sources: ? 1.25 v internal bandgap. ? 2.5 v internal bandgap. ? v dd . ? 5 v internal differential bandgap. ? external single ended input from ch. 6. ? differential input, 2x(ch. 6 - ch. 7). ? unbuffered 2xv dd . ? the 2.5 v reference needs a supply voltage higher than 2.5 v. ? the differential 5 v reference needs a supply voltage higher than 2.75 v. since the 2xv dd differential reference is unbuffered, it is directly connected to the adc supply voltage and more susceptible to supply noise. the v dd reference is buffered both in single ended and differential mode. if a differential reference with a larger range than the supply voltage is combined with single ended measurements, for instance the 5 v internal reference, the full adc range will not be available because the maximum input voltage is limited by the maximum electrical ratings. note single ended measurements with the external differential reference are not supported. 28.3.6 programming of bias current the bias current of the bandgap reference and the adc comparator can be scaled by the biasprog, halfbias and compbias bit fields of the adcn_biasprog register. the biasprog and halfbias bitfields scale the current of adc bandgap reference, and the compbias bits provide an additional bias programming for the adc comparator as illustrated in figure 28.5 (p. 686 ) . the electrical characteristics given in the datasheet require the bias configuration to be set to the default values, where no other bias values are given.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 686 www.energymicro.com figure 28.5. adc bias programming compbias biasprog halfbias reference current int ernal bandgap reference adc com parat or the minimum value of the biasprog and compbias bitfields of the adcn_biasprog register (i.e. biasprog=0b0000, compbias=0b0000) represent the minimum bias currents. similarly biasprog=0b1111 and compbias=0b1111 represent the maximum bias currents. additionally, the bias current defined by the biasprog setting can be halved by setting the halfbias bit of the adcn_biasprog register. the bias current settings should only be changed while the adc is disabled. 28.3.7 adc modes the adc contains two separate programmable modes, one single sample mode and one scan mode. both modes have separate configuration and result registers and can be set up to run only once per trigger or repetitively. the scan mode has priority over the single sample mode. however, if scan sequence is running, a triggered single sample will be interleaved between two scan samples. 28.3.7.1 single sample mode the single sample mode can be used to convert a single sample either once per trigger or repetitively. the configuration of the single sample mode is done in the adcn_singlectrl register and the results are found in the adcn_singledata register. the singledv bit in adcn_status is set high when there is valid data in the result register and is cleared when the data is read. the single mode results can also be read through adcn_singledatap without singledv being cleared. diff in adcn_singlectrl selects whether differential or single ended inputs are used and inputsel selects input pin(s). 28.3.7.2 scan mode the scan mode is used to perform sweeps of the inputs. the configuration of the scan sequence is done in the adcn_scanctrl register and the results are found in the adcn_scandata register. the scandv bit in adcn_status is set high when there is valid data in the result register and is cleared when the data is read. the scan mode results can also be read through adcn_scandatap without scandv being cleared. the inputs included in the sequence are defined by a the mask in inputmask in adcn_scanctrl. when the scan sequence is triggered, the sequence samples all inputs that are included in the mask, starting at the lowest pin number. diff in adcn_scanctrl selects whether single ended or differential inputs are used. 28.3.7.3 conversion tailgating the scan sequence has priority over the single sample mode. however, a scan trigger will not interrupt in the middle of a single conversion. if a scan sequence is triggered by a timer on a periodic basis, single sample just before a scan trigger can delay the start of the scan sequence, thus causing jitter in sample rate. to solve this, conversion tailgating can be chosen by setting tailgate in adcn_ctrl. when this bit is set, any triggered single samples will wait for the next scan sequence to finish before
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 687 www.energymicro.com activating (see figure 28.6 (p. 687 ) ). the single sample will then follow immediately after the scan sequence. in this way, the scan sequence will always start immediately when triggered, if the period between the scan triggers is big enough to allow any single samples that might be triggered to finish in between the scan sequences. figure 28.6. adc conversion tailgating singlestart scanstart scanact adc act ion singleact scan single scan single scan 28.3.7.4 conversion trigger the conversion modes can be activated by writing a 1 to the singlestart or scanstart bit in the adcn_cmd register. the conversions can be stopped by writing a 1 to the singlestop or scanstop bit in the adcn_cmd register. a start command will have priority over a stop command. when the adc is stopped in the middle of a conversion, the result buffer is cleared. the singleact and scanact bits in adcn_status are set high when the modes are actively converting or have pending conversions. it is also possible to trigger conversions from prs signals. the system requires one hfperclk cycle pulses to trigger conversions. setting prsen in adcn_singlectrl/adcn_scanctrl enables triggering from prs input. which prs channel to listen to is defined by prssel in adcn_singlectrl/adcn_scanctrl. when prs trigger is selected, it is still possible to trigger the conversion from software. the reader is referred to the prs datasheet for more information on how to set up the prs channels. note the conversion settings should not be changed while the adc is running as this can lead to unpredictable behavior. the prescaled clock phase is always reset by a triggered conversion as long as a conversion is not ongoing. this gives predictable latency from the time of the trigger to the time the conversion starts, regardless of when in the prescaled clock cycle the trigger occur. 28.3.7.5 results the results are presented in 2?s complement form and the format for differential and single ended mode is given in table 28.1 (p. 687 ) and table 28.2 (p. 688 ) . if differential mode is selected, the results are sign extended up to 32-bit (shown in table 28.4 (p. 689 ) ). table 28.1. adc single ended conversion results input/reference binary hex value 1 111111111111 fff 0.5 011111111111 7ff 1/4096 000000000001 001 0 000000000000 000
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 688 www.energymicro.com table 28.2. adc differential conversion results input/reference binary hex value 0.5 011111111111 7ff 0.25 001111111111 3ff 1/2048 000000000001 001 0 000000000000 000 -1/2048 111111111111 fff -0.25 101111111111 bff -0.5 100000000000 800 28.3.7.6 resolution the adc gives out 12-bit results, by default. however, if full 12-bit resolution is not needed, it is possible to speed up the conversion by selecting a lower resolution (n = 6 or 8 bits). for more information on the accuracy of the adc, the reader is referred to the electrical characteristics section for the device. 28.3.7.7 oversampling to achieve higher accuracy, hardware oversampling can be enabled individually for each mode (set res in adcn_singlectrl/adcn_scanctrl to 0x3). the oversampling rate (ovsrsel in adcn_ctrl) can be set to any integer power of 2 from 2 to 4096 and the configuration is shared between the scan and single sample mode (ovsrsel field in adcn_ctrl). with oversampling, each selected input is sampled a number (given by the ovsr) of times, and the results are filtered by a first order accumulate and dump filter to form the end result. the data presented in the adcn_singledata and adcn_scandata registers are the direct contents of the accumulation register (sum of samples). however, if the oversampling ratio is set higher than 16x, the accumulated results are shifted to fit the msb in bit 15 as shown in table 28.3 (p. 688 ) . table 28.3. oversampling result shifting and resolution oversampling setting # right shifts result resolution # bits 2x 0 13 4x 0 14 8x 0 15 16x 0 16 32x 1 16 64x 2 16 128x 3 16 256x 4 16 512x 5 16 1024x 6 16 2048x 7 16 4096x 8 16
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 689 www.energymicro.com 28.3.7.8 adjustment by default, all results are right adjusted, with the lsb of the result in bit position 0 (zero). in differential mode the signed bit is extended up to bit 31, but in single ended mode the bits above the result are read as 0. by setting adj in adcn_singlectrl/adcn_scanctrl, the results are left adjusted as shown in table 28.4 (p. 689 ) . when left adjusted, the msb is always placed on bit 15 and sign extended to bit 31. all bits below the conversion result are read as 0 (zero). table 28.4. adc results representation bit adjustment resolution 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 12 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 10 9 8 7 6 5 4 3 2 1 0 8 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 5 4 3 2 1 0 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 0 right ovs 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 12 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 10 9 8 7 6 5 4 3 2 1 0 - - - - 8 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 5 4 3 2 1 0 - - - - - - - - 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 0 - - - - - - - - - - left ovs 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 28.3.8 interrupts, prs output the single and scan modes have separate interrupt flags indicating finished conversions. setting one of these flags will result in an adc interrupt if the corresponding interrupt enable bit is set in adcn_ien. in addition to the finished conversion flags, there is a scan and single sample result overflow flag which signalizes that a result from a scan sequence or single sample has been overwritten before being read. a finished conversion will result in a one hfperclk cycle pulse which is output to the peripheral reflex system (prs). 28.3.9 dma request the adc has two dma request lines, single and scan, which are set when a single or scan conversion has completed. the request are cleared when the corresponding single or scan result register is read. 28.3.10 calibration the adc supports offset and gain calibration to correct errors due to process and temperature variations. this must be done individually for each reference used. the adc calibration (adcn_cal) register contains four register fields for calibrating offset and gain for both single and scan mode. the gain and offset calibration are done in single mode, but the resulting calibration values can be used for both single and scan mode. gain and offset for the 1v25, 2v5 and vdd references are calibrated during production and the calibration values for these can be found in the device information page. during reset, the gain and offset calibration registers are loaded with the production calibration values for the 1v25 reference. the scangain and singlegain calibration fields are not used when the unbuffered differential 2xvdd reference is selected.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 690 www.energymicro.com the effects of changing the calibration register values are given in table 28.5 (p. 690 ) . step by step calibration procedures for offset and gain are given in section 28.3.10.1 (p. 690 ) and section 28.3.10.2 (p. 690 ) . table 28.5. calibration register effect calibration register adc result calibration binary value calibration hex value lowest output 0111111 3f offset highest output 1000000 40 lowest output 0000000 00 gain highest output 1111111 7f the offset calibration register expects a signed 2?s complement value with negative effect. a high value gives a low adc reading. the gain calibration register expects an unsigned value with positive effect. a high value gives a high adc reading. 28.3.10.1 offset calibration offset calibration must be performed prior to gain calibration. follow these steps for the offset calibration in single mode: 1. select wanted reference by setting the ref bitfield of the adcn_singlectrl register. 2. set the at bitfield of the adcn_singlectrl register to 16cycles. 3. set the inputsel bitfield of the adcn_singlectrl register to diff0, and set the diff bitfield to 1 for enabling differential input. since the input voltage is 0, the expected adc output is the half of the adc code range as it is in differential mode. 4. a binary search is used to find the offset calibration value. set the singlestart bit in the adcn_cmd register and read the adcn_singledata register. the result of the binary search is written to the singleoffset field of the adcn_cal register. 28.3.10.2 gain calibration offset calibration must be performed prior to gain calibration. the gain calibration is done in the following manner: 1. select an external adc channel (a differential channel can also be used). 2. apply an external voltage on the selected adc input channel. this voltage should correspond to the top of the adc range. 3. a binary search is used to find the gain calibration value. set the singlestart bit in the adcn_ctrl register and read the adcn_singledata register. the target value is ideally the top of the adc range, but it is recommended to use a value a couple of lsbs below in order to avoid overshooting. the result of the binary search is written to the singlegain field of the adcn_cal register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 691 www.energymicro.com 28.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 adcn_ctrl rw control register 0x004 adcn_cmd w1 command register 0x008 adcn_status r status register 0x00c adcn_singlectrl rw single sample control register 0x010 adcn_scanctrl rw scan control register 0x014 adcn_ien rw interrupt enable register 0x018 adcn_if r interrupt flag register 0x01c adcn_ifs w1 interrupt flag set register 0x020 adcn_ifc w1 interrupt flag clear register 0x024 adcn_singledata r single conversion result data 0x028 adcn_scandata r scan conversion result data 0x02c adcn_singledatap r single conversion result data peek register 0x030 adcn_scandatap r scan sequence result data peek register 0x034 adcn_cal rw calibration register 0x03c adcn_biasprog rw bias programming register 28.5 register description 28.5.1 adcn_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x1f 0x00 0x0 0 0x0 access rw rw rw rw rw rw name ovsrsel timebase presc lpfmode tailgate warmupmode bit name reset access description 31:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 27:24 ovsrsel 0x0 rw oversample rate select select oversampling rate. oversampling must be enabled for each mode for this setting to take effect. value mode description 0 x2 2 samples for each conversion result 1 x4 4 samples for each conversion result 2 x8 8 samples for each conversion result 3 x16 16 samples for each conversion result 4 x32 32 samples for each conversion result 5 x64 64 samples for each conversion result 6 x128 128 samples for each conversion result 7 x256 256 samples for each conversion result 8 x512 512 samples for each conversion result
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 692 www.energymicro.com bit name reset access description value mode description 9 x1024 1024 samples for each conversion result 10 x2048 2048 samples for each conversion result 11 x4096 4096 samples for each conversion result 23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22:16 timebase 0x1f rw time base set time base used for adc warm up sequence according to the hfperclk frequency. the time base is defined as a number of hfperclk cycles which should be set equal to or higher than 1us. value description timebase adc warm-up is set to timebase+1 hfperclk clock cycles and bandgap warm-up is set to 5x(timebase+1) hfperclk cycles. 15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14:8 presc 0x00 rw prescaler setting select clock division factor. value description presc clock division factor of presc+1. 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:4 lpfmode 0x0 rw low pass filter mode these bits control the filtering of the adc input. details on the filter characteristics can be found in the device datasheets. value mode description 0 bypass no filter or decoupling capacitor 1 decap on chip decoupling capacitor selected 2 rcfilt on chip rc filter selected 3 tailgate 0 rw conversion tailgating enable/disable conversion tailgating. value description 0 scan sequence has priority, but can be delayed by ongoing single samples. 1 scan sequence has priority and single samples will only start immediately after scan sequence. 2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 warmupmode 0x0 rw warm-up mode select warm-up mode for adc value mode description 0 normal adc is shut down after each conversion 1 fastbg bandgap references do not need warm up, but have reduced accuracy. 2 keepscanrefwarm reference selected for scan mode is kept warm. 3 keepadcwarm adc is kept warmed up and scan reference is kept warm 28.5.2 adcn_cmd - command register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name scanstop scanstart singlestop singlestart
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 693 www.energymicro.com bit name reset access description 31:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3 scanstop 0 w1 scan sequence stop write a 1 to stop scan sequence. 2 scanstart 0 w1 scan sequence start write a 1 to start scan sequence. 1 singlestop 0 w1 single conversion stop write a 1 to stop single conversion. 0 singlestart 0 w1 single conversion start write to 1 to start single conversion. 28.5.3 adcn_status - status register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 0 0 0 access r r r r r r r r name scandatasrc scandv singledv warm scanrefwarm singlerefwarm scanact singleact bit name reset access description 31:27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26:24 scandatasrc 0x0 r scan data source this value indicates from which input channel the results in the adcn_scandata register originates. value mode description 0 ch0 single ended mode: scandata result originates from adcn_ch0. differential mode: scandata result originates from adcn_ch0-adcn_ch1 1 ch1 single ended mode: scandata result originates from adcn_ch1. differential mode: scandata result originates from adcn_ch2_adcn_ch3 2 ch2 single ended mode: scandata result originates from adcn_ch2. differential mode: scandata result originates from adcn_ch4-adcn_ch5 3 ch3 single ended mode: scandata result originates from adcn_ch3. differential mode: scandata result originates from adcn_ch6-adcn_ch7 4 ch4 scandata result originates from adcn_ch4 5 ch5 scandata result originates from adcn_ch5 6 ch6 scandata result originates from adcn_ch6 7 ch7 scandata result originates from adcn_ch7 23:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17 scandv 0 r scan data valid scan conversion data is valid. 16 singledv 0 r single sample data valid single conversion data is valid. 15:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12 warm 0 r adc warmed up adc is warmed up. 11:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9 scanrefwarm 0 r scan reference warmed up
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 694 www.energymicro.com bit name reset access description reference selected for scan mode is warmed up. 8 singlerefwarm 0 r single reference warmed up reference selected for single mode is warmed up. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 scanact 0 r scan conversion active scan sequence is active or has pending conversions. 0 singleact 0 r single conversion active single conversion is active or has pending conversions. 28.5.4 adcn_singlectrl - single sample control register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0x0 0x0 0x0 0x0 0 0 0 access rw rw rw rw rw rw rw rw rw name prssel prsen at ref inputsel res adj diff rep bit name reset access description 31:28 prssel 0x0 rw single sample prs trigger select select prs trigger for single sample. value mode description 0 prsch0 prs ch 0 triggers single sample 1 prsch1 prs ch 1 triggers single sample 2 prsch2 prs ch 2 triggers single sample 3 prsch3 prs ch 3 triggers single sample 4 prsch4 prs ch 4 triggers single sample 5 prsch5 prs ch 5 triggers single sample 6 prsch6 prs ch 6 triggers single sample 7 prsch7 prs ch 7 triggers single sample 8 prsch8 prs ch 8 triggers single sample 9 prsch9 prs ch 9 triggers single sample 10 prsch10 prs ch 10 triggers single sample 11 prsch11 prs ch 11 triggers single sample 27:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24 prsen 0 rw single sample prs trigger enable enabled/disable prs trigger of single sample. value description 0 single sample is not triggered by prs input 1 single sample is triggered by prs input selected by prssel 23:20 at 0x0 rw single sample acquisition time select the acquisition time for single sample. value mode description 0 1cycle 1 adc_clk cycle acquisition time for single sample 1 2cycles 2 adc_clk cycles acquisition time for single sample 2 4cycles 4 adc_clk cycles acquisition time for single sample 3 8cycles 8 adc_clk cycles acquisition time for single sample
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 695 www.energymicro.com bit name reset access description value mode description 4 16cycles 16 adc_clk cycles acquisition time for single sample 5 32cycles 32 adc_clk cycles acquisition time for single sample 6 64cycles 64 adc_clk cycles acquisition time for single sample 7 128cycles 128 adc_clk cycles acquisition time for single sample 8 256cycles 256 adc_clk cycles acquisition time for single sample 19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:16 ref 0x0 rw single sample reference selection select reference to adc single sample mode. value mode description 0 1v25 internal 1.25 v reference 1 2v5 internal 2.5 v reference 2 vdd buffered vdd 3 5vdiff internal differential 5 v reference 4 extsingle single ended external reference from pin 6 5 2xextdiff differential external reference, 2x(pin 6 - pin 7) 6 2xvdd unbuffered 2xvdd 15:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:8 inputsel 0x0 rw single sample input selection select input to adc single sample mode in either single ended mode or differential mode. diff = 0 mode value description ch0 0 adcn_ch0 ch1 1 adcn_ch1 ch2 2 adcn_ch2 ch3 3 adcn_ch3 ch4 4 adcn_ch4 ch5 5 adcn_ch5 ch6 6 adcn_ch6 ch7 7 adcn_ch7 temp 8 temperature reference vdddiv3 9 vdd/3 vdd 10 vdd vss 11 vss vrefdiv2 12 vref/2 dac0out0 13 dac0 output 0 dac0out1 14 dac0 output 1 diff = 1 mode value description ch0ch1 0 positive input: adcn_ch0 negative input: adcn_ch1 ch2ch3 1 positive input: adcn_ch2 negative input: adcn_ch3 ch4ch5 2 positive input: adcn_ch4 negative input: adcn_ch5 ch6ch7 3 positive input: adcn_ch6 negative input: adcn_ch7 diff0 4 differential 0 (short between positive and negative inputs) 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:4 res 0x0 rw single sample resolution select select single sample conversion resolution. value mode description 0 12bit 12-bit resolution 1 8bit 8-bit resolution 2 6bit 6-bit resolution
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 696 www.energymicro.com bit name reset access description value mode description 3 ovs oversampling enabled. oversampling rate is set in ovsrsel 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 adj 0 rw single sample result adjustment select single sample result adjustment. value mode description 0 right results are right adjusted 1 left results are left adjusted 1 diff 0 rw single sample differential mode select single ended or differential input. value description 0 single ended input 1 differential input 0 rep 0 rw single sample repetitive mode enable/disable repetitive single samples. value description 0 single conversion mode is deactivated after one conversion 1 single conversion mode is converting continuously until singlestop is written 28.5.5 adcn_scanctrl - scan control register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0x0 0x0 0x00 0x0 0 0 0 access rw rw rw rw rw rw rw rw rw name prssel prsen at ref inputmask res adj diff rep bit name reset access description 31:28 prssel 0x0 rw scan sequence prs trigger select select prs trigger for scan sequence. value mode description 0 prsch0 prs ch 0 triggers scan sequence 1 prsch1 prs ch 1 triggers scan sequence 2 prsch2 prs ch 2 triggers scan sequence 3 prsch3 prs ch 3 triggers scan sequence 4 prsch4 prs ch 4 triggers scan sequence 5 prsch5 prs ch 5 triggers scan sequence 6 prsch6 prs ch 6 triggers scan sequence 7 prsch7 prs ch 7 triggers scan sequence 8 prsch8 prs ch 8 triggers scan sequence 9 prsch9 prs ch 9 triggers scan sequence 10 prsch10 prs ch 10 triggers scan sequence 11 prsch11 prs ch 11 triggers scan sequence 27:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24 prsen 0 rw scan sequence prs trigger enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 697 www.energymicro.com bit name reset access description enabled/disable prs trigger of scan sequence. value description 0 scan sequence is not triggered by prs input 1 scan sequence is triggered by prs input selected by prssel 23:20 at 0x0 rw scan sample acquisition time select the acquisition time for scan samples. value mode description 0 1cycle 1 adc_clk cycle acquisition time for scan samples 1 2cycles 2 adc_clk cycles acquisition time for scan samples 2 4cycles 4 adc_clk cycles acquisition time for scan samples 3 8cycles 8 adc_clk cycles acquisition time for scan samples 4 16cycles 16 adc_clk cycles acquisition time for scan samples 5 32cycles 32 adc_clk cycles acquisition time for scan samples 6 64cycles 64 adc_clk cycles acquisition time for scan samples 7 128cycles 128 adc_clk cycles acquisition time for scan samples 8 256cycles 256 adc_clk cycles acquisition time for scan samples 19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:16 ref 0x0 rw scan sequence reference selection select reference to adc scan sequence. value mode description 0 1v25 internal 1.25 v reference 1 2v5 internal 2.5 v reference 2 vdd vdd 3 5vdiff internal differential 5 v reference 4 extsingle single ended external reference from pin 6 5 2xextdiff differential external reference, 2x(pin 6 - pin 7) 6 2xvdd unbuffered 2xvdd 15:8 inputmask 0x00 rw scan sequence input mask set one or more bits in this mask to select which inputs are included the scan sequence in either single ended or differential mode. diff = 0 mode value description ch0 00000001 adcn_ch0 included in mask ch1 00000010 adcn_ch1 included in mask ch2 00000100 adcn_ch2 included in mask ch3 00001000 adcn_ch3 included in mask ch4 00010000 adcn_ch4 included in mask ch5 00100000 adcn_ch5 included in mask ch6 01000000 adcn_ch6 included in mask ch7 10000000 adcn_ch7 included in mask diff = 1 mode value description ch0ch1 00000001 (positive input: adcn_ch0 negative input: adcn_ch1) included in mask ch2ch3 00000010 (positive input: adcn_ch2 negative input: adcn_ch3) included in mask ch4ch5 00000100 (positive input: adcn_ch4 negative input: adcn_ch5) included in mask ch6ch7 00001000 (positive input: adcn_ch6 negative input: adcn_ch7) included in mask 0001xxxx-1111xxxx reserved 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:4 res 0x0 rw scan sequence resolution select
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 698 www.energymicro.com bit name reset access description select scan sequence conversion resolution. value mode description 0 12bit 12-bit resolution 1 8bit 8-bit resolution 2 6bit 6-bit resolution 3 ovs oversampling enabled. oversampling rate is set in ovsrsel 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 adj 0 rw scan sequence result adjustment select scan sequence result adjustment. value mode description 0 right results are right adjusted 1 left results are left adjusted 1 diff 0 rw scan sequence differential mode select single ended or differential input. value description 0 single ended input 1 differential input 0 rep 0 rw scan sequence repetitive mode enable/disable repetitive scan sequence. value description 0 scan conversion mode is deactivated after one sequence 1 scan conversion mode is converting continuously until scanstop is written 28.5.6 adcn_ien - interrupt enable register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access rw rw rw rw name scanof singleof scan single bit name reset access description 31:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9 scanof 0 rw scan result overflow interrupt enable enable/disable scan result overflow interrupt. 8 singleof 0 rw single result overflow interrupt enable enable/disable single result overflow interrupt. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 scan 0 rw scan conversion complete interrupt enable enable/disable scan conversion complete interrupt. 0 single 0 rw single conversion complete interrupt enable enable/disable single conversion complete interrupt.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 699 www.energymicro.com 28.5.7 adcn_if - interrupt flag register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access r r r r name scanof singleof scan single bit name reset access description 31:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9 scanof 0 r scan result overflow interrupt flag indicates scan result overflow when this bit is set. 8 singleof 0 r single result overflow interrupt flag indicates single result overflow when this bit is set. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 scan 0 r scan conversion complete interrupt flag indicates scan conversion complete when this bit is set. 0 single 0 r single conversion complete interrupt flag indicates single conversion complete when this bit is set. 28.5.8 adcn_ifs - interrupt flag set register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name scanof singleof scan single bit name reset access description 31:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9 scanof 0 w1 scan result overflow interrupt flag set write to 1 to set scan result overflow interrupt flag 8 singleof 0 w1 single result overflow interrupt flag set write to 1 to set single result overflow interrupt flag. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 scan 0 w1 scan conversion complete interrupt flag set write to 1 to set scan conversion complete interrupt flag. 0 single 0 w1 single conversion complete interrupt flag set write to 1 to set single conversion complete interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 700 www.energymicro.com 28.5.9 adcn_ifc - interrupt flag clear register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name scanof singleof scan single bit name reset access description 31:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9 scanof 0 w1 scan result overflow interrupt flag clear write to 1 to clear scan result overflow interrupt flag. 8 singleof 0 w1 single result overflow interrupt flag clear write to 1 to clear single result overflow interrupt flag. 7:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 scan 0 w1 scan conversion complete interrupt flag clear write to 1 to clear scan conversion complete interrupt flag. 0 single 0 w1 single conversion complete interrupt flag clear write to 1 to clear single conversion complete interrupt flag. 28.5.10 adcn_singledata - single conversion result data offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access r name data bit name reset access description 31:0 data 0x00000000 r single conversion result data the register holds the results from the last single conversion. reading this field clears the singledv bit in the adcn_status register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 701 www.energymicro.com 28.5.11 adcn_scandata - scan conversion result data offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access r name data bit name reset access description 31:0 data 0x00000000 r scan conversion result data the register holds the results from the last scan conversion. reading this field clears the scandv bit in the adcn_status register. 28.5.12 adcn_singledatap - single conversion result data peek register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access r name datap bit name reset access description 31:0 datap 0x00000000 r single conversion result data peek the register holds the results from the last single conversion. reading this field will not clear singledv in adcn_status or single dma request.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 702 www.energymicro.com 28.5.13 adcn_scandatap - scan sequence result data peek register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access r name datap bit name reset access description 31:0 datap 0x00000000 r scan conversion result data peek the register holds the results from the last scan conversion. reading this field will not clear scandv in adcn_status or single dma request. 28.5.14 adcn_cal - calibration register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x3f 0x00 0x3f 0x00 access rw rw rw rw name scangain scanoffset singlegain singleoffset bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:24 scangain 0x3f rw scan mode gain calibration value this register contains the gain calibration value used with scan conversions. this field is set to the production gain calibration value for the 1v25 internal reference during reset, hence the reset value might differ from device to device. the field is unsigned. higher values lead to higher adc results. 23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22:16 scanoffset 0x00 rw scan mode offset calibration value this register contains the offset calibration value used with scan conversions. this field is set to the production offset calibration value for the 1v25 internal reference during reset, hence the reset value might differ from device to device. the field is encoded as a signed 2's complement number. higher values lead to lower adc results. 15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14:8 singlegain 0x3f rw single mode gain calibration value this register contains the gain calibration value used with single conversions. this field is set to the production gain calibration value for the 1v25 internal reference during reset, hence the reset value might differ from device to device. the field is unsigned. higher values lead to higher adc results. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:0 singleoffset 0x00 rw single mode offset calibration value
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 703 www.energymicro.com bit name reset access description this register contains the offset calibration value used with single conversions. this field is set to the production offset calibration value for the 1v25 internal reference during reset, hence the reset value might differ from device to device. the field is encoded as a signed 2's complement number. higher values lead to lower adc results. 28.5.15 adcn_biasprog - bias programming register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x7 1 0x7 access rw rw rw name compbias halfbias biasprog bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:8 compbias 0x7 rw comparator bias value these bits are used to adjust the bias current to the adc comparator. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 halfbias 1 rw half bias current set this bit to halve the bias current. 5:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 biasprog 0x7 rw bias programming value these bits are used to adjust the bias current.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 704 www.energymicro.com 29 dac - digital to analog converter 0 1 2 3 4 dac ...0100010... ...0101110... quick facts what? the dac is designed for low energy consumption, but can also provide very good performance. it can convert digital values to analog signals at up to 500 kilo samples/ second and with 12-bit accuracy. why? the dac is able to generate accurate analog signals using only a limited amount of energy. how? the dac can generate high-resolution analog signals while the mcu is operating at low frequencies and with low total power consumption. using dma and a timer, the dac can be used to generate waveforms without any cpu intervention. 29.1 introduction the digital to analog converter (dac) can convert a digital value to an analog output voltage. the dac is fully differential rail-to-rail, with 12-bit resolution. it has two single ended output buffers which can be combined into one differential output. the dac may be used for a number of different applications such as sensor interfaces or sound output. 29.2 features ? 500 ksamples/s operation ? two single ended output channels ? can be combined into one differential output ? integrated prescaler with division factor selectable between 1-128 ? selectable voltage reference ? internal 2.5v ? internal 1.25v ? v dd ? conversion triggers ? data write ? prs input ? automatic refresh timer ? selection from 16-64 prescaled hfperclk cycles ? individual refresh enable for each channel ? interrupt generation on finished conversion ? separate interrupt flag for each channel ? prs output pulse on finished conversion ? separate line for each channel ? dma request on finished conversion ? separate request for each channel ? support for offset and gain calibration
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 705 www.energymicro.com ? output to adc ? sine generation mode ? optional high strength line driver 29.3 functional description an overview of the dac module is shown in figure 29.1 (p. 705 ) . figure 29.1. dac overview dacn_out0 dacn_out1 ch 1 vdd 1.25 v 2.5 v ch0data ch1data adc and acmp refsel ch 0 29.3.1 conversions the dac consists of two channels (channel 0 and 1) with separate 12-bit data registers (dacn_ch0data and dacn_ch1data). these can be used to produce two independent single ended outputs or the channel 0 register can be used to drive both outputs in differential mode. the dac supports three conversion modes, continuous, sample/hold, sample/off. 29.3.1.1 continuous mode in continuous mode the dac channels will drive their outputs continuously with the data in the dacn_chxdata registers. this mode will maintain the output voltage and refresh is therefore not needed. 29.3.1.2 sample/hold mode in sample/hold mode, the dac cores converts data on a triggered conversion and then holds the output in a sample/hold element. when not converting, the dac cores are turned off between samples, which reduces the power consumption. because of output voltage drift the sample/hold element will only hold the output for a certain period without a refresh conversion. the reader is referred to the electrical characteristics for the details on the voltage drift. 29.3.1.3 sample/off mode in sample/off mode the dac and the sample/hold element is turned completely off between samples, tri-stating the dac output. this requires the dac output voltage to be held externally. the references are also turned off between samples, which means that a new warm-up period is needed before each conversion. 29.3.1.4 conversion start the dac channel must be enabled before it can be used. when the channel is enabled, a conversion can be started by writing to the dacn_chxdata register. these data registers are also mapped into a combined data register, dacn_combdata, where the data values for both channels can be written simultaneously. writing to this register will start all enabled channels.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 706 www.energymicro.com if the prsen bit in dacn_chxctrl is set, a dac conversion on channel x will not be started by data write, but when a positive one hfperclk cycle pulse is received on the prs input selected by prssel in dacn_chxctrl. the ch0dv and ch1dv bits in dacn_status indicate that the corresponding channel contains data that has not yet been converted. when entering energy mode 4, both dac channels must be stopped. 29.3.1.5 clock prescaling the dac has an internal clock prescaler, which can divide the hfperclk by any factor between 1 and 128, by setting the presc bits in dacnctrl. the resulting dac_clk is used by the converter core and the frequency is given by equation 29.1 (p. 706 ) : dac clock prescaling f dac_clk = f hfperclk / 2 ^ presc (29.1) where f hfperclk is the hfperclk frequency. one conversion takes 2 dac_clk cycles and the dac_clk should not be set higher than 1 mhz. normally the prescaler runs continuously when either of the channels are enabled. when running with a prescaler setting higher than 0, there will be an unpredictable delay from the time the conversion was triggered to the time the actual conversion takes place. this is because the conversions is controlled by the prescaled clock and the conversion can arrive at any time during a prescaled clock (dac_clk) period. however, if the ch0prescrst bit in dacn_ctrl is set, the prescaler will be reset every time a conversion is triggered on channel 0. this leads to a predictable latency between channel 0 trigger and conversion. 29.3.2 reference selection three internal voltage references are available and are selected by setting the refsel bits in dacn_ctrl: ? internal 2.5v ? internal 1.25v ? v dd the reference selection can only be changed while both channels are disabled. the references for the dac need to be enabled for some time before they can be used. this is called the warm-up period, and starts when one of the channels is enabled. for a bandgap reference, this period is 5 dac_clk cycles while the v dd reference needs 1 dac_clk cycle. the dac will time this period automatically(given that the prescaler is set correctly) and delay any conversion triggers received during the warm-up until the references have stabilized. 29.3.3 programming of bias current the bias current of the bandgap reference and the dac output buffer can be scaled by the biasprog and halfbias bit fields of the dacn_biasprog register as illustrated in figure 29.2 (p. 707 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 707 www.energymicro.com figure 29.2. dac bias programming biasprog halfbias reference current int ernal bandgap reference dac out put buffer the minimum value of the biasprog bit-field of the dacn_biasprog register (i.e. biasprog=0b0000) represents the minimum bias current. similarly biasprog=0b1111 represents the maximum bias current. the bias current defined by the biasprog setting can be halved by setting the halfbias bit of the dacn_biasprog register. the bias current settings should only be changed while both dac channels are disabled. the electrical characteristics given in the datasheet require the bias configuration to be set to the default values, where no other bias values are given. 29.3.4 mode the two dac channels can act as two separate single ended channels or be combined into one differential channel. this is selected through the diff bit in dacn_ctrl. 29.3.4.1 single ended output when operating in single ended mode, the channel 0 output is on dacn_out0 and the channel 1 output is on dacn_out1. the output voltage can be calculated using equation 29.2 (p. 707 ) dac single ended output voltage v out = v dacn_outx - v ss = v ref x chxdata/4095 (29.2) where chxdata is a 12-bit unsigned integer. 29.3.4.2 differential output when operating in differential mode, both dac outputs are used as output for the bipolar voltage. the differential conversion uses dacn_ch0data as source. the positive output is on dacn_out1 and the negative output is on dacn_out0. since the output can be negative, it is expected that the data is written in 2?s complement form with the msb of the 12-bit value being the signed bit. the output voltage can be calculated using equation 29.3 (p. 707 ) : dac differential output voltage v out = v dacn_out1 - v dacn_out0 = v ref x ch0data/2047 (29.3) where ch0data is a 12-bit signed integer. the common mode voltage is v dd /2. 29.3.5 sine generation mode the dac contains an automatic sine-generation mode, which is enabled by setting the sinemode bit in dacn_ctrl. in this mode, the dac data is overridden with a conversion data taken from a sine lookup
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 708 www.energymicro.com table. the sine signal is controlled by the prs line selected by ch0prssel in dacn_ch0ctrl. when the prs line is low, a voltage of vref/2 will be produced. when the line is high, a sine wave will be produced. each period, starting at 0 degrees, is made up of 16 samples and the frequency is given by equation 29.4 (p. 708 ) : dac sine generation f sine = f hfperclk / 32 x (presc + 1) (29.4) the sine wave will be output on channel 0. if diff is set in dacn_ctrl, the sine wave will be output on both channels (if enabled), but inverted (see figure 29.1 (p. 705 ) ). note that when outenprs in dacn_ctrl is set, the sine output will be reset to 0 degrees when the prs line selected by ch1prssel is low. figure 29.3. dac sine mode ch1 prs dacn_out1 dacn_out0 hi-z hi-z ch0 prs vref 0 vref/2 vref 0 vref/2 29.3.6 interrupts and prs output both dac channels have separate interrupt flags (in dacn_if) indicating that a conversion has finished on the channel and that new data can be written to the data registers. setting one of these flags will result in a dac interrupt if the corresponding interrupt enable bit is set in dacn_ien. all generated interrupts from the dac will activate the same interrupt vector when enabled. the dac has two prs outputs which will carry a one cycle (hfperclk) high pulse when the corresponding channel has finished a conversion. 29.3.7 dma request the dac sends out a dma request when a conversion on a channel is complete. this request is cleared when the corresponding channel?s data register is written. 29.3.8 analog output each dac channel has its own output pin (dacn_out0 and dacn_out1) in addition to an internal loopback to the adc and acmp . these outputs can be enabled and disabled individually in the en field in dacn_chxctrl registers in combination with outputsel in dacn_ctrl. the dac outputs can also be directed to the adc and acmp , which is also configurable in the outputsel field in dacn_ctrl. the dac outputs are tri-stated when the channels are not enabled. by setting the outenprs bit in dacn_ctrl, the outputs are also tri-stated when the prs line selected by ch1prssel in dacn_ch1ctrl is low. when the prs signal is high, the outputs are enabled as normal.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 709 www.energymicro.com 29.3.9 calibration the dac contains a calibration register, dacn_cal, where calibration values for both offset and gain correction can be written. offset calibration is done separately for each channel through the chxoffset bit-fields. gain is calibrated in one common register field, gain. the gain calibration is linked to the reference and when the reference is changed, the gain must be re-calibrated. gain and offset for the 1v25, 2v5 and vdd references are calibrated during production and the calibration values for these can be found in the device information page. during reset, the gain and offset calibration registers are loaded with the production calibration values for the 1v25 reference. 29.3.10 opamps the dac includes a set of three highly configurable opamps that can be accessed in the dac module. two of the opamps are located in the dac, while the third opamp is a standalone opamp. for detailed description see the opamp chapter. the register description can be found section 29.5 (p. 710 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 710 www.energymicro.com 29.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 dacn_ctrl rw control register 0x004 dacn_status r status register 0x008 dacn_ch0ctrl rw channel 0 control register 0x00c dacn_ch1ctrl rw channel 1 control register 0x010 dacn_ien rw interrupt enable register 0x014 dacn_if r interrupt flag register 0x018 dacn_ifs w1 interrupt flag set register 0x01c dacn_ifc w1 interrupt flag clear register 0x020 dacn_ch0data rw channel 0 data register 0x024 dacn_ch1data rw channel 1 data register 0x028 dacn_combdata w combined data register 0x02c dacn_cal rw calibration register 0x030 dacn_biasprog rw bias programming register 0x054 dacn_opactrl rw operational amplifier control register 0x058 dacn_opaoffset rw operational amplifier offset register 0x05c dacn_opa0mux rw operational amplifier mux configuration register 0x060 dacn_opa1mux rw operational amplifier mux configuration register 0x064 dacn_opa2mux rw operational amplifier mux configuration register 29.5 register description 29.5.1 dacn_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0 0 0x1 0x0 0 0 access rw rw rw rw rw rw rw rw rw name refrsel presc refsel ch0prescrst outenprs outmode convmode sinemode diff bit name reset access description 31:22 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 21:20 refrsel 0x0 rw refresh interval select select refresh counter timeout value. a channel x will be refreshed with the interval set in this register if the refren bit in dacn_chxctrl is set. value mode description 0 8cycles all channels with enabled refresh are refreshed every 8 prescaled cycles 1 16cycles all channels with enabled refresh are refreshed every 16 prescaled cycles 2 32cycles all channels with enabled refresh are refreshed every 32 prescaled cycles
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 711 www.energymicro.com bit name reset access description value mode description 3 64cycles all channels with enabled refresh are refreshed every 64 prescaled cycles 19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:16 presc 0x0 rw prescaler setting select clock division factor. value description presc clock division factor of 2^presc. 15:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:8 refsel 0x0 rw reference selection select reference. value mode description 0 1v25 internal 1.25 v bandgap reference 1 2v5 internal 2.5 v bandgap reference 2 vdd vdd reference 7 ch0prescrst 0 rw channel 0 start reset prescaler select if prescaler is reset on channel 0 start. value description 0 prescaler not reset on channel 0 start 1 prescaler reset on channel 0 start 6 outenprs 0 rw prs controlled output enable enable prs control of dac output enable. value description 0 dac output enable always on 1 dac output enable controlled by prs signal selected for ch1. 5:4 outmode 0x1 rw output mode select output mode. value mode description 0 disable dac output to pin and adc disabled 1 pin dac output to pin enabled. dac output to adc and acmp disabled 2 adc dac output to pin disabled. dac output to adc and acmp enabled 3 pinadc dac output to pin, adc, and acmp enabled 3:2 convmode 0x0 rw conversion mode configure conversion mode. value mode description 0 continuous dac is set in continuous mode 1 samplehold dac is set in sample/hold mode 2 sampleoff dac is set in sample/shut off mode 1 sinemode 0 rw sine mode enable/disable sine mode. value description 0 sine mode disabled. sine reset to 0 degrees 1 sine mode enabled 0 diff 0 rw differential mode select single ended or differential mode. value description 0 single ended output 1 differential output
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 712 www.energymicro.com 29.5.2 dacn_status - status register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access r r name ch1dv ch0dv bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 ch1dv 0 r channel 1 data valid this bit is set high when ch1data is written and is set low when ch1data is used in conversion. 0 ch0dv 0 r channel 0 data valid this bit is set high when ch0data is written and is set low when ch0data is used in conversion. 29.5.3 dacn_ch0ctrl - channel 0 control register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 access rw rw rw rw name prssel prsen refren en bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:4 prssel 0x0 rw channel 0 prs trigger select select channel 0 prs input channel. value mode description 0 prsch0 prs ch 0 triggers channel 0 conversion. 1 prsch1 prs ch 1 triggers channel 1 conversion. 2 prsch2 prs ch 2 triggers channel 2 conversion. 3 prsch3 prs ch 3 triggers channel 3 conversion. 4 prsch4 prs ch 4 triggers channel 4 conversion. 5 prsch5 prs ch 5 triggers channel 5 conversion. 6 prsch6 prs ch 6 triggers channel 6 conversion. 7 prsch7 prs ch 7 triggers channel 7 conversion. 8 prsch8 prs ch 8 triggers channel 8 conversion. 9 prsch9 prs ch 9 triggers channel 9 conversion. 10 prsch10 prs ch 10 triggers channel 10 conversion. 11 prsch11 prs ch 11 triggers channel 11 conversion. 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 prsen 0 rw channel 0 prs trigger enable select channel 0 conversion trigger. value description 0 channel 0 is triggered by ch0data or combdata write
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 713 www.energymicro.com bit name reset access description value description 1 channel 0 is triggered by prs input 1 refren 0 rw channel 0 automatic refresh enable set to enable automatic refresh of channel 0. refresh period is set by refrsel in dacn_ctrl. value description 0 channel 0 is not refreshed automatically 1 channel 0 is refreshed automatically 0 en 0 rw channel 0 enable enable/disable channel 0. 29.5.4 dacn_ch1ctrl - channel 1 control register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 access rw rw rw rw name prssel prsen refren en bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:4 prssel 0x0 rw channel 1 prs trigger select select channel 1 prs input channel. value mode description 0 prsch0 prs ch 0 triggers channel 1 conversion. 1 prsch1 prs ch 1 triggers channel 1 conversion. 2 prsch2 prs ch 2 triggers channel 1 conversion. 3 prsch3 prs ch 3 triggers channel 1 conversion. 4 prsch4 prs ch 4 triggers channel 1 conversion. 5 prsch5 prs ch 5 triggers channel 1 conversion. 6 prsch6 prs ch 6 triggers channel 1 conversion. 7 prsch7 prs ch 7 triggers channel 1 conversion. 8 prsch8 prs ch 8 triggers channel 1 conversion. 9 prsch9 prs ch 9 triggers channel 1 conversion. 10 prsch10 prs ch 10 triggers channel 1 conversion. 11 prsch11 prs ch 11 triggers channel 1 conversion. 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 prsen 0 rw channel 1 prs trigger enable select channel 1 conversion trigger. value description 0 channel 1 is triggered by ch1data or combdata write 1 channel 1 is triggered by prs input 1 refren 0 rw channel 1 automatic refresh enable set to enable automatic refresh of channel 1. refresh period is set by refrsel in dacn_ctrl. value description 0 channel 1 is not refreshed automatically 1 channel 1 is refreshed automatically
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 714 www.energymicro.com bit name reset access description 0 en 0 rw channel 1 enable enable/disable channel 1. 29.5.5 dacn_ien - interrupt enable register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access rw rw rw rw name ch1uf ch0uf ch1 ch0 bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ch1uf 0 rw channel 1 conversion data underflow interrupt enable enable/disable channel 1 data underflow interrupt. 4 ch0uf 0 rw channel 0 conversion data underflow interrupt enable enable/disable channel 0 data underflow interrupt. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 ch1 0 rw channel 1 conversion complete interrupt enable enable/disable channel 1 conversion complete interrupt. 0 ch0 0 rw channel 0 conversion complete interrupt enable enable/disable channel 0 conversion complete interrupt. 29.5.6 dacn_if - interrupt flag register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access r r r r name ch1uf ch0uf ch1 ch0 bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ch1uf 0 r channel 1 data underflow interrupt flag indicates channel 1 data underflow. 4 ch0uf 0 r channel 0 data underflow interrupt flag indicates channel 0 data underflow. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 ch1 0 r channel 1 conversion complete interrupt flag indicates channel 1 conversion complete and that new data can be written to the data register. 0 ch0 0 r channel 0 conversion complete interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 715 www.energymicro.com bit name reset access description indicates channel 0 conversion complete and that new data can be written to the data register. 29.5.7 dacn_ifs - interrupt flag set register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name ch1uf ch0uf ch1 ch0 bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ch1uf 0 w1 channel 1 data underflow interrupt flag set write to 1 to set channel 1 data underflow interrupt flag. 4 ch0uf 0 w1 channel 0 data underflow interrupt flag set write to 1 to set channel 0 data underflow interrupt flag. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 ch1 0 w1 channel 1 conversion complete interrupt flag set write to 1 to set channel 1 conversion complete interrupt flag. 0 ch0 0 w1 channel 0 conversion complete interrupt flag set write to 1 to set channel 0 conversion complete interrupt flag. 29.5.8 dacn_ifc - interrupt flag clear register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 access w1 w1 w1 w1 name ch1uf ch0uf ch1 ch0 bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 ch1uf 0 w1 channel 1 data underflow interrupt flag clear write to 1 to clear channel 1 data underflow interrupt flag. 4 ch0uf 0 w1 channel 0 data underflow interrupt flag clear write to 1 to clear channel 0 data underflow interrupt flag. 3:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 ch1 0 w1 channel 1 conversion complete interrupt flag clear write to 1 to clear channel 1 conversion complete interrupt flag. 0 ch0 0 w1 channel 0 conversion complete interrupt flag clear write to 1 to clear channel 0 conversion complete interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 716 www.energymicro.com 29.5.9 dacn_ch0data - channel 0 data register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 access rw name data bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:0 data 0x000 rw channel 0 data this register contains the value which will be converted by channel 0. 29.5.10 dacn_ch1data - channel 1 data register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 access rw name data bit name reset access description 31:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:0 data 0x000 rw channel 1 data this register contains the value which will be converted by channel 1. 29.5.11 dacn_combdata - combined data register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 0x000 access w w name ch1data ch0data bit name reset access description 31:28 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 717 www.energymicro.com bit name reset access description 27:16 ch1data 0x000 w channel 1 data data written to this register will be written to data in dacn_ch1data. 15:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:0 ch0data 0x000 w channel 0 data data written to this register will be written to data in dacn_ch0data. 29.5.12 dacn_cal - calibration register offset bit position 0x02c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x40 0x00 0x00 access rw rw rw name gain ch1offset ch0offset bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22:16 gain 0x40 rw gain calibration value this register contains the gain calibration value. this field is set to the production gain calibration value for the 1v25 internal reference during reset, hence the reset value might differ from device to device. the field is unsigned. higher values lead to lower dac results. 15:14 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 13:8 ch1offset 0x00 rw channel 1 offset calibration value this register contains the offset calibration value used with channel 1 conversions. this field is set to the production channel 1 offset calibration value for the 1v25 internal reference during reset, hence the reset value might differ from device to device. the field is sign-magnitude encoded. higher values lead to lower dac results. 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:0 ch0offset 0x00 rw channel 0 offset calibration value this register contains the offset calibration value used with channel 0 conversions. this field is set to the production channel 0 offset calibration value for the 1v25 internal reference during reset, hence the reset value might differ from device to device. the field is sign-magnitude encoded. higher values lead to lower dac results. 29.5.13 dacn_biasprog - bias programming register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 0x7 1 0x7 access rw rw rw rw name opa2halfbias opa2biasprog halfbias biasprog bit name reset access description 31:15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14 opa2halfbias 1 rw half bias current
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 718 www.energymicro.com bit name reset access description set this bit to halve the bias current. 13:12 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 11:8 opa2biasprog 0x7 rw bias programming value for opa2 these bits control the bias current level. 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 halfbias 1 rw half bias current set this bit to halve the bias current. 5:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 biasprog 0x7 rw bias programming value these bits control the bias current level. 29.5.14 dacn_opactrl - operational amplifier control register offset bit position 0x054 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0x0 0x0 0x0 0 0 0 0 0 0 access rw rw rw rw rw rw rw rw rw rw rw rw name opa2short opa1short opa0short opa2lpfdis opa1lpfdis opa0lpfdis opa2hcmdis opa1hcmdis opa0hcmdis opa2en opa1en opa0en bit name reset access description 31:25 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 24 opa2short 0 rw short the non-inverting and inverting input. set to short the non-inverting and inverting input. 23 opa1short 0 rw short the non-inverting and inverting input. set to short the non-inverting and inverting input. 22 opa0short 0 rw short the non-inverting and inverting input. set to short the non-inverting and inverting input. 21:18 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 17:16 opa2lpfdis 0x0 rw disables low pass filter. disables the low pass filter between pad and the positive and negative input mux. lpf disable value description plpfdis x1 disables the low pass filter between positive pad and positive input. nlpfdis 1x disables the low pass filter between negative pad and negative input. 15:14 opa1lpfdis 0x0 rw disables low pass filter. disables the low pass filter between pad and the positive and negative input mux. lpf disable value description plpfdis x1 disables the low pass filter between positive pad and positive input. nlpfdis 1x disables the low pass filter between negative pad and negative input. 13:12 opa0lpfdis 0x0 rw disables low pass filter. disables the low pass filter between pad and the positive and negative input mux.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 719 www.energymicro.com bit name reset access description lpf disable value description plpfdis x1 disables the low pass filter between positive pad and positive input. nlpfdis 1x disables the low pass filter between negative pad and negative input. 11:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 opa2hcmdis 0 rw high common mode disable. set to disable high common mode. disables rail-to-rail on input, while output still remains rail-to-rail. the input voltage to the opamp while hcm is disabled is restricted between vss and vdd-1.2v. 7 opa1hcmdis 0 rw high common mode disable. set to disable high common mode. disables rail-to-rail on input, while output still remains rail-to-rail. the input voltage to the opamp while hcm is disabled is restricted between vss and vdd-1.2v. 6 opa0hcmdis 0 rw high common mode disable. set to disable high common mode. disables rail-to-rail on input, while output still remains rail-to-rail. the input voltage to the opamp while hcm is disabled is restricted between vss and vdd-1.2v. 5:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 opa2en 0 rw opa2 enable set to enable opa2, clear to disable. 1 opa1en 0 rw opa1 enable set to enable opa1, clear to disable. ch1en in dac_ch1ctrl must also be set. 0 opa0en 0 rw opa0 enable set to enable opa0, clear to disable. ch0en in dac_ch0ctrl must also be set. 29.5.15 dacn_opaoffset - operational amplifier offset register offset bit position 0x058 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name opa2offset bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:0 opa2offset 0x00 rw opa2 offset configuration value this register contains the offset calibration value for opa2. this field is set to the production opa2 offset calibration value, hence the reset value might differ from device to device. the field is sign-magnitude encoded. higher values lead to lower opa results. the resolution of the lsb is 1.6mv/lsb
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 720 www.energymicro.com 29.5.16 dacn_opa0mux - operational amplifier mux configuration register offset bit position 0x05c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0x1 0x00 0 0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw rw name ressel nextout outmode outpen npen ppen resinmux negsel possel bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:28 ressel 0x0 rw opa0 resistor ladder select configures the resistor ladder tap for opa0. value mode resistor value inverting mode gain (-r2/r1) non-inverting mode gain (1+(r2/ r1) 0 res0 r2 = 1/3 x r1 -1/3 1 1/3 1 res1 r2 = r1 -1 2 2 res2 r2 = 1 2/3 x r1 -1 2/3 2 2/3 3 res3 r2 = 2 x r1 -2 1/5 3 1/5 4 res4 r2 = 3 x r1 -3 4 5 res5 r2 = 4 1/3 x r1 -4 1/3 5 1/3 6 res6 r2 = 7 x r1 -7 8 7 res7 r2 = 15 x r1 -15 16 27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26 nextout 0 rw opa0 next enable makes output of opa0 available to opa1. 25:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23:22 outmode 0x1 rw output select select output channel. value mode description 0 disable opa0 output is disabled 1 main main opa0 output to pin enabled 2 alt opa0 alternative output enabled. 3 all main opa0 output drives both main and alternative outputs. 21:19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:14 outpen 0x00 rw opa0 output enable value set to enable output, clear to disable output out enable value description out0 xxxx1 alternate output 0 out1 xxx1x alternate output 1 out2 xx1xx alternate output 2 out3 x1xxx alternate output 3 out4 1xxxx alternate output 4 13 npen 0 rw opa0 negative pad input enable connects pad to the negative input mux 12 ppen 0 rw opa0 positive pad input enable connects pad to the positive input mux
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 721 www.energymicro.com bit name reset access description 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 resinmux 0x0 rw opa0 resistor ladder input mux these bits selects the source for the input mux to the resistor ladder value mode description 0 disable set for unity gain 1 opa0inp set for opa0 input 2 negpad neg pad connected 3 pospad pos pad connected 4 vss vss connected 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:4 negsel 0x0 rw opa0 inverting input mux these bits selects the source for the inverting input on opa0 value mode description 0 disable input disabled 1 ug unity gain feedback path 2 opatap opa0 resistor ladder as input 3 negpad input from neg pad 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2:0 possel 0x0 rw opa0 non-inverting input mux these bits selects the source for the non-inverting input on opa0 value mode description 0 disable input disabled 1 dac dac as input 2 pospad pos pad as input 3 opa0inp opa0 as input 4 opatap opa0 resistor ladder as input 29.5.17 dacn_opa1mux - operational amplifier mux configuration register offset bit position 0x060 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0x0 0x00 0 0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw rw name ressel nextout outmode outpen npen ppen resinmux negsel possel bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:28 ressel 0x0 rw opa1 resistor ladder select configures the resistor ladder tap for opa1. value mode resistor value inverting mode gain (-r2/r1) non-inverting mode gain (1+(r2/ r1) 0 res0 r2 = 1/3 x r1 -1/3 1 1/3 1 res1 r2 = r1 -1 2 2 res2 r2 = 1 2/3 x r1 -1 2/3 2 2/3 3 res3 r2 = 2 x r1 -2 1/5 3 1/5
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 722 www.energymicro.com bit name reset access description value mode resistor value inverting mode gain (-r2/r1) non-inverting mode gain (1+(r2/ r1) 4 res4 r2 = 3 x r1 -3 4 5 res5 r2 = 4 1/3 x r1 -4 1/3 5 1/3 6 res6 r2 = 7 x r1 -7 8 7 res7 r2 = 15 x r1 -15 16 27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26 nextout 0 rw opa1 next enable makes output of opa1 available to opa2. 25:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23:22 outmode 0x0 rw output select select output channel. value mode description 0 disable opa0 output is disabled 1 main main opa1 output to pin enabled 2 alt opa1 alternative output enabled. 3 all main opa1 output drives both main and alternative outputs. 21:19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:14 outpen 0x00 rw opa1 output enable value set to enable output, clear to disable output out enable value description out0 xxxx1 alternate output 0 out1 xxx1x alternate output 1 out2 xx1xx alternate output 2 out3 x1xxx alternate output 3 out4 1xxxx alternate output 4 13 npen 0 rw opa1 negative pad input enable connects pad to the negative input mux 12 ppen 0 rw opa1 positive pad input enable connects pad to the positive input mux 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 resinmux 0x0 rw opa1 resistor ladder input mux these bits selects the source for the input mux to the resistor ladder value mode description 0 disable set for unity gain 1 opa0inp set for opa0 input 2 negpad neg pad connected 3 pospad pos pad connected 4 vss vss connected 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:4 negsel 0x0 rw opa1 inverting input mux these bits selects the source for the inverting input on opa1 value mode description 0 disable input disabled 1 ug unity gain feedback path 2 opatap opa1 resistor ladder as input 3 negpad input from neg pad 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 723 www.energymicro.com bit name reset access description 2:0 possel 0x0 rw opa1 non-inverting input mux these bits selects the source for the non-inverting input on opa1 value mode description 0 disable input disabled 1 dac dac as input 2 pospad pos pad as input 3 opa0inp opa0 as input 4 opatap opa 1 resistor ladder as input 29.5.18 dacn_opa2mux - operational amplifier mux configuration register offset bit position 0x064 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0x0 0 0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw rw name ressel nextout outmode outpen npen ppen resinmux negsel possel bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:28 ressel 0x0 rw opa2 resistor ladder select configures the resistor ladder tap for opa2. value mode resistor value inverting mode gain (-r2/r1) non-inverting mode gain (1+(r2/ r1) 0 res0 r2 = 1/3 x r1 -1/3 1 1/3 1 res1 r2 = r1 -1 2 2 res2 r2 = 1 2/3 x r1 -1 2/3 2 2/3 3 res3 r2 = 2 x r1 -2 1/5 3 1/5 4 res4 r2 = 3 x r1 -3 4 5 res5 r2 = 4 1/3 x r1 -4 1/3 5 1/3 6 res6 r2 = 7 x r1 -7 8 7 res7 r2 = 15 x r1 -15 16 27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26 nextout 0 rw opa2 next enable opa2 does not have an next output. 25:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 outmode 0 rw output select enables opa2 main output. 21:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:14 outpen 0x0 rw opa2 output location select location for main output value mode description 1 out0 main output 0 2 out1 main output 1 13 npen 0 rw opa2 negative pad input enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 724 www.energymicro.com bit name reset access description connects pad to the negative input mux 12 ppen 0 rw opa2 positive pad input enable connects pad to the positive input mux 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 resinmux 0x0 rw opa2 resistor ladder input mux these bits selects the source for the input mux to the resistor ladder value mode description 0 disable set for unity gain 1 opa1inp set for opa1 input 2 negpad neg pad connected 3 pospad pos pad connected 4 vss vss connected 7:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:4 negsel 0x0 rw opa2 inverting input mux these bits selects the source for the inverting input on opa2 value mode description 0 disable input disabled 1 ug unity gain feedback path 2 opatap opa2 resistor ladder as input 3 negpad input from neg pad 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2:0 possel 0x0 rw opa2 non-inverting input mux these bits selects the source for the non-inverting input on opa2 value mode description 0 disable input disabled 2 pospad pos pad as input 3 opa1inp opa1 as input 4 opatap opa0 resistor ladder as input
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 725 www.energymicro.com 30 opamp - operational amplifier 0 1 2 3 4 vin - + vout quick facts what? the opamps are low power amplifiers with a high degree of flexibility targeting a wide variety of standard opamp application areas. with flexible gain and interconnection built- in programming they can be configured to support multiple common opamp functions, with all pins available externally for filter configurations. each opamp has a rail to rail input and a rail to rail output. why? the opamps are included to save energy on a pcb compared to standalone opamps, but also reduce system cost by replacing external opamps. how? two of the opamps are made available as part of the dac, while the third opamp is standalone. an adc unity gain buffer mode configuration makes it possible to isolate kickback noise, in addition to popular differential to single ended and differential to differential driver modes. the opamps can also be configured as a one, two- or three-step cascaded pga, and for all of the built-in modes no external components are necessary. 30.1 introduction the opamps are highly configurable general purpose opamps, suitable for simple filters and buffer applications. the three opamps can be configured to support various operational amplifier functions through a network of muxes, with possibilities of selecting ranges of on-chip non-inverting and inverting gain configurations, and selecting between outputs to various destinations. the opamps can also be configured with external feedback in addition to supporting cascade connections between two or three opamps. the opamps are rail-to-rail in and out. a user selectable mode has been added to optimize linearity, in which case the input voltage to the opamp is restricted between vss and vdd-1.2v. 30.2 features ? 3 individually configurable opamps ? opamps support rail-to-rail inputs and outputs ? supports the following functions ? general opamp mode ? voltage follower unity gain ? inverting input pga ? non-inverting pga ? cascaded inverting pga
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 726 www.energymicro.com ? cascaded non-inverting pga ? two opamp differential amplifier ? three opamp differential amplifier ? dual buffer adc driver ? programmable gain 30.3 functional description the three opamps can be configured to perform various opamp functions through a network of muxes. an overview of the opamps are shown in figure 30.1 (p. 726 ) . two of the three opamps are part of the dac, while the third opamp is standalone. the output of opa0 can be routed to adc ch0, opa1 and various pin outputs. the output of opa1 can be routed to adc ch1, opa2, and various pin outputs. the output of opa2 can be routed to adc ch0, ch5, and various pin output destinations. all three opamps can also take input from pins. since opa0 and opa1 are part of the dac, special considerations needs to be taken when both the dac ch0/ch1 and opa0/opa1 are being used. for detailed explanation the reader is referred to section 30.3.3 (p. 735 ) . figure 30.1. opamp system overview opa0 dac opa0 alt ernat ive out put s opa0 main out put opa0next opa1 opa1 alt ernat ive out put s opa1 main out put opa1next opa2 opa2 main out put s adc ch5 input m ux pos0 neg0 pos1 neg1 pos2 neg2 adc ch0 input m ux adc ch1 input m ux adc ch0 input m ux a more detailed view of the three opamps, including the mux network is shown in figure 30.2 (p. 727 ) . there is a set of input muxes for each opamp, making it possible to select various input sources. the possel mux connected to the positive input makes it possible to select pin, another opamp output, or tap from the resistor network. similarly, the negsel mux on the negative input makes it possible to select pin or a feedback path as its source. the feedback path can be a unity gain configuration, or selected from the resistor network for programmable gain. the output of the opamp have different sets of outputs, a main output, an alternative output network and a next output. these outputs make it possible to route the output to pin, another opamp input, adc, or into the feedback path. for details regarding configuring the outputs, the reader is referred to section 30.3.1.2 (p. 727 ) . in addition, there is also a mux to configure the resistor ladder to be connected to vss, pin, or another opamp output.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 727 www.energymicro.com figure 30.2. opamp overview - + opa0tap opa0tap nextout0 nextout0 vss opa0 possel[ 2:0] negsel[ 1:0] pos0 neg0 ppen npen main out put alt ernat ive out put net work r1 r2 unit y gain pospad nextout0 negpad resinmux[ 3:0] - + opa1tap opa1tap nextout0 nextout0 vss opa1 possel[ 2:0] negsel[ 1:0] pos1 neg1 ppen npen main out put alt ernat ive out put net work r1 r2 unit y gain pospad nextout1 negpad resinmux[ 3:0] - + opa2tap opa0tap nextout1 nextout1 vss opa2 possel[ 2:0] negsel[ 1:0] pos2 neg2 ppen npen main out put r1 r2 unit y gain pospad negpad resinmux[ 3:0] 30.3.1 opamp configuration since two of the three opamps (opa0, opa1) are part of the dac, the opamp configuration registers are located in the dac. the mux registers for opa0/opa1 together with opa2 registers are separate registers, also located under the dac module. opa0 and opa1 can be enabled by setting opaxen in dacn_opactrl and chxen in chxctrl. opa2 can be enabled by only setting opa2en in dacn_opactrl. 30.3.1.1 input configuration the inputs to the opamps are controlled through a set of input muxes. the mux connected to the positive input is configured by the possel bit-field in the dacn_opaxmux register. similarly, the mux connected to the negative input is configured by setting the negsel bit-field in dacn_opaxmux. to connect the pins to the input muxes, the pin switches must also be enabled. setting the ppen bit- field enables to pospadx, while setting the npen bit-field enables the negpadx, both located in dacn_opaxmux. the input into the resistor ladder can be configured by setting the resinmux bit- field in dacn_opaxmux. 30.3.1.2 output configuration the opamp have two outputs, one main output and one alternative output with lower drive strength. these two outputs can be used to drive the different outputs as shown in figure 30.3 (p. 728 ) . the main opamp output can be used to drive the main output by setting outmode to main in dacn_opaxmux. the alternative opamp output can drive the alternative output network by setting outmode to alt in dacn_opaxmux. in addition, it is also possible to use the main opamp output to drive both the main output and the alternative output network by setting outmode to all in dacn_opaxmux.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 728 www.energymicro.com figure 30.3. opamp output stage overview - + opa0 opa0 out put main/all opa0 alt ernat ive out put net work alt/all out0 out1 out2 out3 out4 nextout opa0 main out put adc ch0 input m ux - + opa1 opa1 out put main/all opa1 alt ernat ive out put net work alt/all out0 out1 out2 out3 out4 nextout opa1 main out put adc ch1 input m ux - + opa2 opa2 out put out0 out1 opa2 main out put s adc ch5 input m ux adc ch0 input m ux main the alternative output network consists of connections to pins, adc, and a connection to the next opamp (opa0 to opa1, and opa1 to opa2). the connections to pins can be individually enabled by configuring outpen in dacn_opaxmux register. to enable cascaded opamp configurations, each opamp has a nextout connection. this output makes it possible to connect opa0 to opa1, and opa1 to opa2. this output connection is enabled by setting nextout in dacn_opaxmux. the opamps can also be routed to the adc. opa0 can be connected to adc ch0, opa1 to adc ch1 and opa2 can be connected to both adc ch1 and ch5. the adc connections are created by routing the opa output by setting corresponding bits in outpen in dacn_opaxmux. for opa0 alternative output 4 is connected to adc input mux ch0 when enabled. opa1's alternative output 4 is connected to adc input mux ch1 when enabled. for opa2, the two main outputs can be connected to adc input mux ch0 and adc input mux ch5 respectively when enabled. see section 28.3.4 (p. 684 ) , in the adc chapter for information on how to configure the adc input mux. 30.3.1.3 gain programming the feedback path of each mux includes a resistor ladder, which can be used to select a set of gain values. the gain can be selected by the ressel bit-field located in dacn_opaxmux register. the gain values are taken from tappings of the resistor ladder based on ratio of r2/r1. it is also possible to bypass the resistor ladder in unity gain (ug) mode. 30.3.1.4 offset calibration the offset calibration registers are located in different registers for the opamps. opa0 and opa1's offset can be set through the ch0offset and ch1offset bit-fields respectively in dacn_cal. the offset for opa2 can be set through opa2offset in dacn_opaoffset. 30.3.1.5 shorting non-inverting and inverting input functionality for offset calibration of the opamps has been added, this functionality is enabled by setting the opaxshort bit-field in dacn_opaxctrl. setting this bit-field enables a switch that shorts between the inverting and non-inverting input of the opa, effectively driving the offset voltage of the opamp to the output. using the adc to measure this offset, the calibration register can be adjusted to minimize the output offset. 30.3.1.6 low pass filter the low pass filter is located between the pad and the positive input. the low-pass filter is designed to couple the input signal to local vss for high frequencies and has a 3 db frequency of approximately 130 mhz when driven from a 50 ohm source. the filter adds a parasitic capacitance of approximately 1.2 pf towards local vss when enabled. the filter is enabled out of reset and can be disabled by setting opaxlpfdis in dacn_opaxctrl.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 729 www.energymicro.com 30.3.1.7 disabling of rail-to-rail operation each opamp can have the input rail-to-rail stage disabled by setting the opaxhcmdis bit-field in dacn_opactrl. disabling the rail-to-rail input stage improves linearity of the opamp, thus improving the total harmonic distortion, thd, at the cost of reduced input signal swing. 30.3.2 opamp modes the opamp can be configured to perform different operational amplifier functions by configuring the internal signal routing between the opamps. the modes available are described in the following sections. 30.3.2.1 general opamp mode in this mode the resistor ladder is isolated from the feedback path and input signal routing is defined by opaxpossel and opaxnegsel in dacn_opaxmux. the output signal routing is defined by outpen in dacn_opaxmux table 30.1. general opamp mode configuration opa bit-fields opa configuration opax possel pospadx opax negsel opatap, ug, negpadx opax resinmux nextout, pospadx, negpadx vss 30.3.2.2 voltage follower unity gain in this mode the unity gain feedback path is selected for the negative input by setting the opaxnegsel bit-field to ug in the dacn_opaxmux register as shown in figure 30.4 (p. 729 ) . the positive input is selected by the opaxpossel bit-field, and the output is configured by the outpen bit-field, both in the dacn_opaxmux register. figure 30.4. voltage follower unity gain overview vin - + vout table 30.2. voltage follower unity gain configuration opa bit-fields opa configuration opax possel opatap, nextout, pospadx opax negsel ug opax resinmux disable 30.3.2.3 inverting input pga figure 30.5 (p. 730 ) shows the inverting input pga configuration. in this mode the negative input is connected to the resistor ladder by setting the opaxnegsel bit-field to opatap in the dacn_opaxmux register. this setting provides a programmable gain on the negative input, which can be set by choosing the wanted gain value in the ressel bit-field in dacn_opaxmux. signal ground for the positive input can be generated off-chip through the pad by setting opaxpossel bit-
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 730 www.energymicro.com field to pad in dacn_opaxmux. in addition the output is configured by the outpen bit-field, located in dacn_opaxmux. figure 30.5. inverting input pga overview vout vout= -(vin-pos) r2/r1 + pos r1 r2 pos - + vin table 30.3. inverting input pga configuration opa bit-fields opa configuration opax possel pospadx opax negsel opatap opax resinmux nextout, negpadx, pospadx 30.3.2.4 non-inverting pga figure 30.6 (p. 730 ) shows the non-inverting input configuration. in this mode the negative input is connected to the resistor ladder by setting the opaxnegsel bit-field to opatap in dacn_opaxmux. this setting provides a programmable gain on the negative input, which can be set by choosing the wanted gain value in the ressel bit-field in dacn_opaxmux. in addition the opaxresinmux bit-field must be set to vss or negpad in dacn_opaxmux. the positive input is selected by the opaxpossel bit-field, and the output is configured by the outpen bit-field, both located in dacn_opaxmux. figure 30.6. non-inverting pga overview r1 r2 vin - + vout vout= vin(1+ r2/r1) table 30.4. non-inverting pga configuration opa bit-fields opa configuration opax possel nextout, pospadx opax negsel opatap opax resinmux vss, negpad 30.3.2.5 cascaded inverting pga this mode enables the opamp signals to be internally configured to cascade two or three opamps in inverting mode as shown in figure 30.7 (p. 731 ) . in both cases the positive input will be configured to signal ground by setting opaxpossel bit-field to pad in dacn_opax_mux. when cascaded, the negative input is connected to the resistor ladder by setting the opaxnegsel bit-field to opatap in dacn_opaxmux. the input to the resistor ladder can be configured in the opaxresinmux bit-field in dac_nopaxmux. the output from opa0 can be connected to opa1 to create the second stage by setting the nextout bit-field in dacn_opaxmux. to complete the stage, opa1resinmux field must be set to opa0inp. similarly, the last stage can be created by setting the nextout bit-field in dacn_opa1mux and opa2resinmux bit-field to opa1inp in dacn_opa2mux.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 731 www.energymicro.com figure 30.7. cascaded inverting pga overview r1 r2 vin - + pos0 vout1= -(vin-pos0) x r2/r1 + pos0 vout2= -(vout1-pos1) x r2/r1 + pos1 vout3= -(vout2-pos3) x r2/r1 + pos3 r1 r2 - + pos1 r1 r2 - + pos2 table 30.5. cascaded inverting pga configuration opa opa bit-fields opa configuration opa0 possel pospad0 opa0 negsel opa0tap opa0 resinmux negpad0 opa0 nextout 1 opa1 possel pospad1 opa1 negsel opatap opa1 resinmux opa0inp opa1 nextout 1 opa2 possel pospad2 opa2 negsel opatap opa2 resinmux opa1inp 30.3.2.6 cascaded non-inverting pga this mode enables the opamp signals to be internally configured to cascade two or three opamps in non- inverting mode as shown in figure 30.8 (p. 731 ) . in both cases the negative input for all opamps will be connected to the resistor ladder by setting the opaxnegsel bit-field to opatap. in addition the resistor ladder input must be set to vss or negpadx in the opaxresinmux in dacn_opaxmux. when cascaded, the positive input on opa0 is configured by the opa0possel bit-field. the output from opa0 can be connected to opa1 to create the second stage by setting nextout in dacn_opa0mux. to complete the stage, the opa1possel bit-field must be set to opa0inp in dacn_opa1mux. similarly, the last stage can be created by setting nextout in dacn_opa1mux and opa2possel bit-field to opa1inp in dacn_opa2mux. figure 30.8. cascaded non-inverting pga overview r1 r2 vin - + vout1= vin(1+ r2/r1) vout2= vin(1+ r2/r1) vout3= vin(1+ r2/r1) r1 r2 - + r1 r2 - +
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 732 www.energymicro.com table 30.6. cascaded non-inverting pga configuration opa opa bit-fields opa configuration opa0 possel pospad0 opa0 negsel opatap opa0 resinmux vss, negpad0 opa0 nextout 1 opa1 possel opa0inp opa1 negsel opatap opa1 resinmux vss, negpad1 opa1 nextout 1 opa2 possel opa1inp opa2 negsel opatap opa2 resinmux vss, negpad2 30.3.2.7 two opamp differential amplifier this mode enables opa0 and opa1 or opa1 and opa2 to be internally configured to form a two opamp differential amplifier as shown in figure 30.9 (p. 733 ) . when using opa0 and opa1, the positive input of opa0 can be connected to any input by configuring the opa0possel bit-field in dacn_opa0mux. the opa0 feedback path must be configured to unity gain by setting the opa0negsel bit-field to ug in dacn_opa0mux. in addition, the opa0resinmux bit-field must be set to disabled. the opa0out must be connected to opa1 by setting nextout in dacn_opa0mux, and opa1resinmux to opa0inp. the positive input on opa1 can be set by configuring opa1possel. the opa1 output can be configured by configuring the outpen and outmode bit-field. when using opa1 and opa2, the positive input of opa1 can be connected to any input by configuring the opa1possel bit-field in dacn_opa1mux. the opa1 feedback path must be configured to unity gain by setting the opa1negsel bit-field to ug in dacn_opa1mux. in addition, the opa1resinmux bit-field must be set to disabled. the opa1out must be connected to opa2 by setting nextout in dacn_opa1mux, and opa2resinmux to opa1inp. the positive input on opa2 can be set by configuring opa2possel. the opa2 output can be configured by configuring the outpen and outmode bit-field. note when making a differential connection with the adc, only opa1 and opa2 can be used
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 733 www.energymicro.com figure 30.9. two op-amp differential amplifier overview r1 r2 v2 - + - + v1 vdiff= (v2-v1)r2/r1 opa0 opa1 r1 r2 v2 - + - + v1 vdiff= (v2-v1)r2/r1 opa1 opa2 table 30.7. opa0/opa1 differential amplifier configuration opa opa bit-fields opa configuration opa0 possel pospad1 opa0 negsel ug opa0 resinmux disable opa0 nextout 1 opa1 possel pospad1 opa1 negsel opatap opa1 resinmux opa1inp table 30.8. opa1/opa2 differential amplifier configuration opa opa bit-fields opa configuration opa1 possel pospad1 opa1 negsel ug opa1 resinmux disable opa1 nextout 1 opa2 possel pospad1 opa2 negsel opatap opa2 resinmux opa1inp 30.3.2.8 three opamp differential amplifier this mode enables the three opamps to be internally configured to form a three opamp differential amplifier as shown in figure 30.10 (p. 734 ) . both opa0 and opa1 can be configured in the same unity gain mode. for both opa0/opa1 the positive input can be connected to any input by configuring the opa0possel/opa1possel bit-field. the opa0/opa1 feedback path must be configured to unity gain by setting the opa0negsel/opa1negsel bit-field to ug. in addition the opa0resinmux/ opa1resinmux bit-fields must be set to disabled. the opa1 output must be connected to opa2 by setting the nextout bit-field in dacn_opa1mux and opa2resinmux to opa1inp in
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 734 www.energymicro.com dacn_opa2mux. in addition the opa2possel must be set to 0patap. the opa2 output can be configured by configuring the outpen and outmode bit-field. figure 30.10. three op-amp differential amplifier overview r1 r2 v2 - + vout vout= (v2-v1)r2/r1 r1 r2 - + - + v1 opa1 opa0 opa2 the gain values for the three opamp differential amplifier is determined by the combination of the gain settings of opa0 and opa2. the 3 different gain values available, 1/3, 1 and 3, can be programmed as shown in the table below. table 30.9. three opamp differential amplifier gain programming gain opa0 ressel opa2 ressel 1/3 4 0 1 1 1 3 0 4 table 30.10. three opamp differential amplifier configuration opa opa bit-fields opa configuration opa0 possel pospad opa0 negsel ug opa0 resinmux disable opa1 possel pospad opa1 negsel ug opa1 resinmux disable opa1 nextout 1 opa2 possel opatap opa2 negsel opatap opa2 resinmux opa1inp 30.3.2.9 dual buffer adc driver it is possible to use opa0 and opa1 to form a dual buffer adc driver as shown in figure 30.11 (p. 735 ) . both opamps used can be configured in the same way. the positive input is configured by setting the 0paxpossel to pad and the negative input can be connected to the resistor ladder by setting opatap in dacn_opaxmux. the output from the opamps can be configured to connect to the adc by setting outmode to alt or all in dacn_opaxmux.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 735 www.energymicro.com figure 30.11. dual buffer adc driver overview r1 r2 vip - + voutp= vip(1+ r2/r1) or voutp = vip (unit y gain) voutn= vin(1+ r2/r1) or voutn = vin (unit y gain) r1 r2 vin - + table 30.11. dual buffer adc driver configuration opa opa bit-fields opa configuration opa0 possel pospad0 opa0 negsel opatap opa0 resinmux vss opa1 possel pospad1 opa1 negsel opatap opa1 resinmux vss 30.3.3 opamp dac combination since two of the opamps are part of the dac it is not possible to use both dac channels and all three opamps at the same time. if both dac channels are used, only opa2 is available out of the 3 opamps. however, it is possible to use one of the dac channels in combination with opa0/opa1. opa1 is available when dac channel 0 is in use and opa0 is available when dac channel 1 is used. when using the opamp dac combination, the dac convmode can only be configured to either continuous or samplehold mode. the convmode bitfield can be configured in dacn_ctrl register. in the opamp/dac combination, the dac channel enabled is configured through the dac registers while the opamp is controlled through the opamp registers. 30.4 register description the register description of the opamp can be found in section 29.4 (p. 710 ) in the dac chapter. 30.5 register map the register map of the opamp can be found in section 29.4 (p. 710 ) in the dac chapter.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 736 www.energymicro.com 31 aes - advanced encryption standard accelerator 0 1 2 3 4 how are you? aes & g# %5 ! t4/# 2 i am fine aes quick facts what? a fast and energy efficient hardware accelerator for aes-128 and aes-256 encryption and decryption. why? efficient encryption/decryption with little or no cpu intervention helps to meet the speed and energy demands of the application. how? high aes throughput allows the EFM32WG to spend more time in lower energy modes. in addition, specialized data access functions allow autonomous dma/aes operation in both em0 and em1. 31.1 introduction the advanced encryption standard (fips-197) is a symmetric block cipher operating on 128-bit blocks of data and 128-, 192- or 256-bit keys. the aes accelerator performs aes encryption and decryption with 128-bit or 256-bit keys. encrypting or decrypting one 128-bit data block takes 54 hfcoreclk cycles with 128-bit keys and 75 hfcoreclk cycles with 256-bit keys. the aes module is an ahb slave which enables efficient access to the data and key registers. all write accesses to the aes module must be 32-bit operations, i.e. 8- or 16-bit operations are not supported. 31.2 features ? aes hardware encryption/decryption ? 128-bit key (54 hfcoreclk cycles) ? 256-bit key (75 hfcoreclk cycles) ? efficient cpu/dma support ? interrupt on finished encryption/decryption ? dma request on finished encryption/decryption ? key buffer in aes128 mode ? optional xor on data write ? configurable byte ordering 31.3 functional description some data and a key must be loaded into the key and data registers before an encryption or decryption can take place. the input data before encryption is called the plaintext and output from the encryption is called ciphertext. for encryption, the key is called plainkey. after one encryption, the resulting key in the key registers is the cipherkey. this key must be loaded into the key registers before every decryption. after one decryption, the resulting key will be the plainkey. the resulting plainkey/cipherkey is only dependent on the value in the key registers before encryption/decryption. the resulting keys and data are shown in figure 31.1 (p. 737 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 737 www.energymicro.com figure 31.1. aes key and data definitions plaintext ciphertext plainkey cipherkey encrypt ion decrypt ion encrypt ion decrypt ion 31.3.1 encryption/decryption the aes module can be set to encrypt or decrypt by clearing/setting the decrypt bit in aes_ctrl. the aes256 bit in aes_ctrl configures the size of the key used for encryption/decryption. the aes_ctrl register should not be altered while aes is running, as this may lead to unpredictable behaviour. an aes encryption/decryption can be started in the following ways: ? writing a 1 to the start bit in aes_cmd ? writing 4 times 32 bits to aes_data when the datastart control bit is set ? writing 4 times 32 bits to aes_xordata when the xorstart control bit is set an aes encryption/decryption can be stopped by writing a 1 to the stop bit in aes_cmd. the running bit in aes_status indicates that an aes encryption/decryption is ongoing. 31.3.2 data and key access the aes module contains a 128-bit data (state) register and two 128-bit key registers defined as data3-data0, key3-key0 (keyl) and key7-key4 (keyh). in aes128 mode, the 128-bit key is read from keyl, while both keyh and keyl are used in aes256 mode. the aes module has configurable byte ordering which is configured in byteorder in aes_ctrl. figure 31.2 (p. 737 ) illustrates how data written to the aes registers is mapped to the key and state defined in the advanced encryption standard (fips-197). the figure presents the key byte order for 256-bit keys. in 128-bit mode with byteorder cleared, a 16 represents the first byte of the 128-bit key. when byteorder is set, a 0 represents the first byte in the key. aes encryption/decryption takes two extra cycles when byteorder is set. byteorder has to be set prior to loading the data and key registers. figure 31.2. aes data and key orientation as defined in the advanced encryption standard data0 data1 data2 data3 key3 key2 key1 key0 data keyl [ 31:24] [ 23:16] [ 15:8] [ 7:0] a 0 a 4 a 1 a 5 a 2 a 6 a 8 a 12 a 9 a 13 a 10 a 14 a 11 a 15 a 3 a 7 byt e order in word s 0 , 0 s 0 , 1 s 1 , 0 s 1 , 1 s 2 , 0 s 2 , 1 s 0 , 2 s 0 , 3 s 1 , 2 s 1 , 3 s 2 , 2 s 2 , 3 s 3 , 2 s 3 , 3 s 3 , 0 s 3 , 1 key7 key6 key5 key4 keyh a 16 a 20 a 17 a 21 a 18 a 22 a 24 a 28 a 25 a 29 a 26 a 30 a 27 a 31 a 19 a 23 byteorder = 0 byteorder = 1 data3 data2 data1 data0 key4 key5 key6 key7 data keyh [ 7:0] [ 15:8] [ 23:16] [ 31:24] a 0 a 4 a 1 a 5 a 2 a 6 a 8 a 12 a 9 a 13 a 10 a 14 a 11 a 15 a 3 a 7 byt e order in word s 0 , 0 s 0 , 1 s 1 , 0 s 1 , 1 s 2 , 0 s 2 , 1 s 0 , 2 s 0 , 3 s 1 , 2 s 1 , 3 s 2 , 2 s 2 , 3 s 3 , 2 s 3 , 3 s 3 , 0 s 3 , 1 key0 key1 key2 key3 keyl a 16 a 20 a 17 a 21 a 18 a 22 a 24 a 28 a 25 a 29 a 26 a 30 a 27 a 31 a 19 a 23 the registers data3-data0, are not memory mapped directly, but can be written/read by accessing aes_data or aes_xordata. the same applies for the key registers, key3-key0 which are accessed through aes_keyln (n=a, b, c or d), while key7-key4 are accessed through keyhn (n=a, b, c or d). writing data3-data0 is then done through 4 consecutive writes to aes_data (or aes_xordata), starting with the word which is to be written to data0. for each write, the words will
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 738 www.energymicro.com be word wise barrel shifted towards the least significant word. accessing the key registers are done in the same fashion through keyln and keyhn. see figure 31.3 (p. 738 ) . note that keyha, keyhb, keyhc and keyhd are really the same register, just mapped to four different addresses. you can then chose freely which of these addresses you want to use to update the key7-key4 registers. the same principle applies to the keyln registers. mapping the same registers to multiple addresses like this, allows the dma controller to write a full 256-bit key in one sweep, when incrementing the address between each word write. figure 31.3. aes data and key register operation data3 writ e dat a read dat a shift on writ e and read data2 data1 data0 aes_data/ aes _xordata key3 writ e dat a read dat a shift on writ e and read key2 key1 key0 aes_keyln key7 writ e dat a read dat a shift on writ e and read key6 key5 key4 aes_keyhn 31.3.2.1 key buffer when encrypting multiple blocks of data in a row, the plainkey must be written to the key register between each encryption, since the contents of the key registers will be turned into the cipherkey during the encryption. the opposite applies when decrypting, where you have to re-supply the cipherkey between each block. however, in aes128 mode, key4-key7 can be used as a buffer register, to hold an extra copy of the key4-key0 registers. when keybufen is set in aes_ctrl, the contents of key7-key4 are copied to key4-key0, when an encryption/decryption is started. this eliminates the need for re-loading the key for every encrypted/decrypted block when running in aes128 mode. 31.3.2.2 data write xor the aes module contains an array of xor gates connected to the data registers, which can be used during a data write to xor the existing contents of the registers with the new data written. to use the xor function, the data must be written to aes_xordata location. reading data from aes_xordata is equivalent to reading data from aes_data. 31.3.2.3 start on data write the aes module can be configured to start an encryption/decryption when the new data has been written to aes_data and/or aes_xordata. a 2-bit counter is incremented each time the aes_data or aes_xordata registers are written. this counter indicates which data word is written. if datastart/ xorstart in aes_ctrl is set, an encryption will start each time the counter overflows (data3 is written). writing to the aes_ctrl register will reset the counter to 0. 31.3.3 interrupt request the done interrupt flag is set when an encryption/ decryption has finished. 31.3.4 dma request the aes module has 4 dma requests which are all set on a finished encryption/decryption and cleared on the following conditions: ? datawr: cleared on a aes_data write or aes_ctrl write ? xordatawr: cleared on a aes_xordata write or aes_ctrl write ? datard: cleared on a aes_data read or aes_ctrl write
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 739 www.energymicro.com ? keywr: cleared on a aes_keyhn write or aes_ctrl write 31.3.5 block chaining example example 31.1 (p. 739 ) below illustrates how the aes module could be configured to perform cipher block chaining with 128-bit keys. example 31.1. aes cipher block chaining 1. configure module to encryption, key buffer enabled and xorstart in aes_ctrl 2. write 128-bit initialization vector to aes_data, starting with least significant word. 3. write plainkey to aes_keyhn, starting with least significant word. 4. write plaintext to aes_xordata, starting with least significant word. encryption will be started when the data3 is written. keyh (plainkey) will be copied to keyl before encryption starts. 5. when encryption finished, read ciphertext from aes_data, starting with least significant word. 6. loop to step 4, if new plaintext is available.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 740 www.energymicro.com 31.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 aes_ctrl rw control register 0x004 aes_cmd w1 command register 0x008 aes_status r status register 0x00c aes_ien rw interrupt enable register 0x010 aes_if r interrupt flag register 0x014 aes_ifs w1 interrupt flag set register 0x018 aes_ifc w1 interrupt flag clear register 0x01c aes_data rw data register 0x020 aes_xordata rw xordata register 0x030 aes_keyla rw key low register 0x034 aes_keylb rw key low register 0x038 aes_keylc rw key low register 0x03c aes_keyld rw key low register 0x040 aes_keyha rw key high register 0x044 aes_keyhb rw key high register 0x048 aes_keyhc rw key high register 0x04c aes_keyhd rw key high register 31.5 register description 31.5.1 aes_ctrl - control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name byteorder xorstart datastart keybufen aes256 decrypt bit name reset access description 31:7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6 byteorder 0 rw configure byte order in data and key registers when set, the byte orders in the data and key registers are swapped before and after encryption/decryption. 5 xorstart 0 rw aes_xordata write start set this bit to start encryption/decryption when data3 is written through aes_xordata. 4 datastart 0 rw aes_data write start set this bit to start encryption/decryption when data3 is written through aes_data. 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 keybufen 0 rw key buffer enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 741 www.energymicro.com bit name reset access description enable/disable key buffer in aes-128 mode. 1 aes256 0 rw aes-256 mode select aes-128 or aes-256 mode. value description 0 aes-128 mode 1 aes-256 mode 0 decrypt 0 rw decryption/encryption mode select encryption or decryption. value description 0 aes encryption 1 aes decryption 31.5.2 aes_cmd - command register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 access w1 w1 name stop start bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 stop 0 w1 encryption/decryption stop set to stop encryption/decryption. 0 start 0 w1 encryption/decryption start set to start encryption/decryption. 31.5.3 aes_status - status register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access r name running bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 running 0 r aes running this bit indicates that the aes module is running an encryption/decryption.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 742 www.energymicro.com 31.5.4 aes_ien - interrupt enable register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name done bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 done 0 rw encryption/decryption done interrupt enable enable/disable interrupt on encryption/decryption done. 31.5.5 aes_if - interrupt flag register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access r name done bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 done 0 r encryption/decryption done interrupt flag set when an encryption/decryption has finished. 31.5.6 aes_ifs - interrupt flag set register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name done bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 done 0 w1 encryption/decryption done interrupt flag set write to 1 to set encryption/decryption done interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 743 www.energymicro.com 31.5.7 aes_ifc - interrupt flag clear register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name done bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 done 0 w1 encryption/decryption done interrupt flag clear write to 1 to clear encryption/decryption done interrupt flag 31.5.8 aes_data - data register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name data bit name reset access description 31:0 data 0x00000000 rw data access access data through this register. 31.5.9 aes_xordata - xordata register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name xordata
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 744 www.energymicro.com bit name reset access description 31:0 xordata 0x00000000 rw xor data access access data with xor function through this register. 31.5.10 aes_keyla - key low register offset bit position 0x030 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name keyla bit name reset access description 31:0 keyla 0x00000000 rw key low access a access the low key words through this register. 31.5.11 aes_keylb - key low register offset bit position 0x034 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name keylb bit name reset access description 31:0 keylb 0x00000000 rw key low access b access the low key words through this register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 745 www.energymicro.com 31.5.12 aes_keylc - key low register offset bit position 0x038 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name keylc bit name reset access description 31:0 keylc 0x00000000 rw key low access c access the low key words through this register. 31.5.13 aes_keyld - key low register offset bit position 0x03c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name keyld bit name reset access description 31:0 keyld 0x00000000 rw key low access d access the low key words through this register. 31.5.14 aes_keyha - key high register offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name keyha
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 746 www.energymicro.com bit name reset access description 31:0 keyha 0x00000000 rw key high access a access the high key words through this register. 31.5.15 aes_keyhb - key high register offset bit position 0x044 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name keyhb bit name reset access description 31:0 keyhb 0x00000000 rw key high access b access the high key words through this register. 31.5.16 aes_keyhc - key high register offset bit position 0x048 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name keyhc bit name reset access description 31:0 keyhc 0x00000000 rw key high access c access the high key words through this register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 747 www.energymicro.com 31.5.17 aes_keyhd - key high register offset bit position 0x04c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name keyhd bit name reset access description 31:0 keyhd 0x00000000 rw key high access d access the high key words through this register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 748 www.energymicro.com 32 gpio - general purpose input/output 0 1 2 3 4 gpio peripherals arm cort ex -m 4 efm32 mcu quick facts what? the gpio (general purpose input/output) is used for pin configuration and direct pin manipulation and sensing as well as routing for peripheral pin connections. why? easy to use and highly configurable input/ output pins are important to fit many communication protocols as well as minimizing software control overhead. flexible routing of peripheral functions helps to ease pcb layout. how? each pin on the device can be individually configured as either an input or an output with several different drive modes. also, individual bit manipulation registers minimizes control overhead. peripheral connections to pins can be routed to several different locations, thus solving congestion issues that may arise with multiple functions on the same pin. fully asynchronous interrupts can also be generated from any pin. 32.1 introduction in the EFM32WG devices the general purpose input/output (gpio) pins are organized into ports with up to 16 pins each. these pins can individually be configured as either an output or input. more advanced configurations like open-drain, filtering and drive strength can also be configured individually for the pins. the gpio pins can also be overridden by peripheral pin connections, like timer pwm outputs or usart communication, which can be routed to several locations on the device. the gpio supports up to 16 asynchronous external pin interrupts, which enables interrupts from any pin on the device. also, the input value of a pin can be routed through the peripheral reflex system to other peripherals. 32.2 features ? individual configuration for each pin ? tristate (reset state) ? push-pull ? open-drain ? pull-up resistor ? pull-down resistor ? drive strength ? 0.5 ma ? 2 ma ? 6 ma ? 20 ma
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 749 www.energymicro.com ? em4 io pin retention. this includes ? output enable ? output value ? pull enable ? pull direction ? em4 wake-up on selected gpio pins ? glitch suppression input filter. ? analog connection to e.g. adc or lcd. ? alternate functions (e.g. peripheral outputs and inputs) ? routed to several locations on the device ? pin connections can be enabled individually ? output data can be overridden by peripheral ? output enable can be overridden by peripheral ? toggle, set and clear registers for output data ? dedicated data input register (read-only) ? interrupts ? 2 interrupt lines from up to 16 pending sources ? all gpio pins are selectable ? separate enable, status, set and clear registers ? asynchronous sensing ? rising, falling or both edges ? wake up from em0-em3 ? peripheral reflex system producer ? all gpio pins are selectable ? configuration lock functionality to avoid accidental changes 32.3 functional description an overview of the gpio module is shown in figure 32.1 (p. 750 ) .the gpio pins are grouped into 16- pin ports. each individual gpio pin is called pxn where x indicates the port (a, b, c ...) and n indicates the pin number (0,1,....,15). fewer than 16 bits may be available on some ports, depending on the total number of i/o pins on the package. after a reset both input and output is disabled for all pins on the device, except for debug pins. to use a pin, the port gpio_px_model/gpio_px_modeh registers must be configured for the pin to make it an input or output. these registers can also do more advanced configuration, which is covered in section 32.3.1 (p. 750 ) . when the port is either configured as an input or an output, the data in register (gpio_px_din) can be used to read the level of each pin in the port (bit n in the register is connected to pin n on the port). when configured as an output, the value of the data out register (gpio_px_dout) will be driven to the pin. the dout value can be changed in 4 different ways ? writing to the gpio_px_dout register. ? writing a 1 to a bit in the gpio_px_doutset register sets the corresponding dout bit ? writing a 1 to a bit in the gpio_px_doutclr register clears the corresponding dout bit ? writing a 1 to a bit in the gpio_px_douttgl register toggles the corresponding dout bit reading the gpio_px_dout register will return its contents. reading the gpio_px_doutset, gpio_px_clr or gpio_px_tgl will return 0.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 750 www.energymicro.com figure 32.1. pin configuration por t con t r ol v ss moden[ 3:0] dout analog connect ion v dd out put enable input enable int errupt input alt ernat e funct ion override alt ernat e funct ion input alt ernat e funct ion out put enable alt ernat e funct ion dat a out dat a out din pull-down enable pull-up enable out put enable out put value 1 glit ch suppression filt er filt er enable prs esd prot ect ion esd diode note there is no esd diode to vdd because if using lcd voltage boost the pin voltage will be higher than vdd. nevertheless there is an esd protection block against over voltage. 32.3.1 pin configuration in addition to setting the pins as either outputs or inputs, the gpio_px_model and gpio_px_modeh registers can be used for more advanced configurations. gpio_px_model contains 8 bit fields named moden (n=0,1,..7) which control pins 0-7, while gpio_px_modeh contains 8 bit fields named moden (n=8,9,..15) which control pins 8-15. in some modes gpio_px_dout is also used for extra configurations like pull-up/down and glitch suppression filter enable. table 32.1 (p. 750 ) shows the available configurations. table 32.1. pin configuration moden input output dout pull- down pull- up alt. strength input filter description 0 input disabled 0b0000 disabled 1 on input disabled with pull-up 0 input enabled 0b0001 1 on input enabled with filter 0 on input enabled with pull-down 0b0010 enabled disabled 1 on input enabled with pull-up
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 751 www.energymicro.com moden input output dout pull- down pull- up alt. strength input filter description 0 on on input enabled with pull-down and filter 0b0011 1 on on input enabled with pull-up and filter 0b0100 x push-pull 0b0101 push-pull x on push-pull with alt. drive strength 0b0110 x open-source 0b0111 open source (wired-or) x on open-source with pull-down 0b1000 x open-drain 0b1001 x on open-drain with filter 0b1010 x on open-drain with pull-up 0b1011 x on on open-drain with pull-up and filter 0b1100 x on open-drain with alt. drive strength 0b1101 x on on open-drain with alt. drive strength and filter 0b1110 x on on open-drain with alt. drive strength and pull-up 0b1111 open drain (wired- and) x on on on open-drain with alt. drive strength, pull-up and filter moden determines which mode the pin is in at a given time. setting moden to 0b0000 disables the pin, reducing power consumption to a minimum. when the output driver is disabled, the pin can be used as a connection for an analog module (e.g. adc, lcd...). input is enabled by setting moden to any value other than 0b0000. the pull-up, pull-down and filter function can optionally be applied to the input, see figure 32.2 (p. 751 ) . the internal pull-up resistance, r pu , and pull-down resistance, r pd , are defined in the device datasheet. when the filter is enabled it suppresses glitches with pulse widths as defined by the parameter t ioglitch in the device datasheet. figure 32.2. tristated output with optional pull-up or pull-down v dd din opt ional pull -up v ss opt ional pull -down input enable analog connect ion glit ch suppression filt er filt er enable when moden=0b0100 or moden=0b0101, the pin operates in push-pull mode. in this mode, the pin is driven either high or low, dependent on the value of gpio_px_dout. the push-pull configuration is shown in figure 32.3 (p. 752 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 752 www.energymicro.com figure 32.3. push-pull configuration input enable dout din out put enable when moden is 0110 or 0111, the pin operates in open-source mode, the latter with a pull-down resistor. when driving a high value in open-source mode, the pull-down is disconnected to save power. for the remaining moden values, i.e. moden >= 1000, the pin operates in open-drain mode as shown in figure 32.4 (p. 752 ) . in open-drain mode, the pin can have an input filter, a pull-up, different driver strengths or any combination of these. when driving a low value in open-drain mode, the pull-up is disconnected to save power. figure 32.4. open-drain v ss dout v dd din opt ional pull -up glit ch suppression filt er filt er enable when moden=0b0101 or 0b11xx, the output driver uses the drive strength specified in drivemode in gpio_px_ctrl. in all other output modes, the drive strength is set to 6 ma. 32.3.1.1 configuration lock gpio_px_model, gpio_px_modeh, gpio_px_ctrl, gpio_px_pinlockn, gpio_extipsell, gpio_extipselh, gpio_insense and gpio_route can be locked by writing any other value than 0xa534 to gpio_lock. writing the value 0xa534 to the gpiox_lock register unlocks the configuration registers. in addition to configuration lock, gpio_px_model, gpio_px_modeh, gpio_px_dout, gpio_px_doutset, gpio_px_doutclr, and gpio_px_douttgl can be locked individually for each pin by clearing the corresponding bit in gpio_px_pinlockn. bits in the gpio_px_pinlockn register can only be cleared, they are set high again after reset. 32.3.2 em4 wake-up it is possible to wake-up from em4 through reset triggered from any of up to 6 selectable gpio pins. for the wake-up logic to work correctly, em4 retention needs to be enabled before entering em4, as described in section 32.3.3 (p. 753 ) the wake-up request can be triggered through the pins by enabling the corresponding bit in the gpio_em4wuen register. when em4 wake-up is enabled for the pin, the input filter is enabled during em4. this is done to avoid false wake-up caused by glitches. in addition, the polarity of the em4 wake-up request can be selected using the gpio_em4wupol register.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 753 www.energymicro.com figure 32.5. em4 wake-up logic gpio_em4wupol wake-up logic gpio_em4wuen gpio_em4wucause wake-up request gpio_cmd the pins used for em4 wake-up must be configured as inputs using the gpio_px_model/ gpio_px_modeh register. before going down to em4, it is important to clear the wake-up logic by setting the em4wuclr bitfield in the gpio_cmd register, which clears the complete wake-up logic, including the gpio_em4wucause register. when the chip comes out of reset, it is possible to determine what caused the reset by reading the rmu_rstcause register. if an em4 wake-up reset occurred, the em4rst (indicating the chip was in em4) and the em4wu (indicating the em4 wake-up reset) bits should be set. it is possible to determine which pin caused the reset by reading the gpio_em4wucause register. the mapping between pins and the bits in the gpio_em4wuen, gpio_em4wupol, and gpio_em4wucause registers are described in table 32.2 (p. 753 ) table 32.2. em4 wu register bits to pin mapping wake-up registers bits pin bit 0 a0 bit 1 a6 bit 2 c9 bit 3 f1 bit 4 f2 bit 5 e13 32.3.3 em4 retention it is possible to enable retention of output enable, output value, pull enable and pull direction when in em4. em4 retention also makes it possible to wake up from em4 on pin reset as described in section 32.3.2 (p. 752 ) em4 retention can be enabled by setting the em4ret field in gpio_ctrl register before going down in em4. 32.3.4 alternate functions alternate functions are connections to pins from timers, usarts etc. these modules contain route registers, where the pin connections are enabled. in addition, these registers contain a location bit field, which configures which pins the outputs of that module will be connected to if they are enabled. if an alternate signal output is enabled for a pin and output is enabled for the pin, the alternate function?s output data and output enable signals override the data output and output enable signals from the gpio. however, the pin configuration stays as set in gpio_px_model, gpio_px_modeh and gpio_px_dout registers. i.e. the pin configuration must be set to output enable in gpio for a peripheral to be able to use the pin as an output. it is possible, but not recommended to select two or more peripherals as output on the same pin. these signals will then be or'ed together. however, timer ccx and cdtix outputs, which are routed as
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 754 www.energymicro.com alternate functions, have priority, and will never be or'ed with other alternate functions. the reader is referred to the pin map section of the device datasheet for more information on the possible locations of each alternate function and any priority settings. 32.3.4.1 serial wire debug port connection the sw debug port is routed as an alternate function and the swdio and swclk pin connections are enabled by default with internal pull down resistors. it is possible to disable these pin connections (and disable the pull down resistors) by setting the swdiopen and swclkpen bits in gpio_route to 0. warning: when the debug pins are disabled, the device can no longer be accessed by a debugger. a reset will set the debug pins back to their default state as enabled. if you do disable the debug pins, make sure you have at least a 3 second timeout at the start of your program code before you disable the debug pins. this way the debugger will have time to halt the device after a reset before the pins are disabled. the serial wire viewer output pin (swo) can be enabled by setting the swopen bit in gpio_route. this bit can also be routed to alternate locations by configuring the location bitfield in gpio_route. 32.3.4.2 etm trace ports there are five trace pins available on the device. one trace clock which can be enabled by setting the tclkpen bitfield in gpio_route. the four data pins can be enabled individually by setting td0pen, td1pen, td2pen, and td3pen respectively in gpio_route. it is possible to choose which pins the trace data will be exported to. the lowest trace bit will be routed to the first enabled trace pin. for example, if the etm data port size is 2 bits and td0 and td3 are enabled, will make bit 0 be routed to td0 while bit 1 will be routed to td3. both the tclk and all the td pins can also be routed to alternate locations by configuring the etmlocation bitifeld in gpio_route. 32.3.4.3 analog connections when using the gpio pin for analog functionality, it is recommended to disable the digital output and set the moden in gpio_px_model/gpio_px_modeh equal to 0b0000 to disable the input sense and pull resistors. 32.3.5 interrupt generation the gpio can generate an interrupt from the input of any gpio pin on a device. the interrupts have asynchronous sense capability, enabling wake-up from energy modes as low as em3, see figure 32.6 (p. 754 ) . figure 32.6. pin n interrupt generation irq_gpio_even/ irq _gpio_odd pan extirise[ n] ien[ n] extipseln[ 2:0] pbn pcn pdn pen if[ n] set clear ifs[ n] ifc[ n] wakeup pfn extifall[ n] prs odd/even input s synch all pins with the same pin number (n) are grouped together to trigger one interrupt flag (ext[n] in gpio_if). the extipseln[2:0] bits in gpio_extipsell or gpio_extipselh select which port will trigger the interrupt flag. the gpio_extirise[n] and gpio_extifall[n] registers enables sensing of
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 755 www.energymicro.com rising and falling edges. by setting the ext[n] bit in gpio_ien, a high interrupt flag n, will trigger one of two interrupt lines. the even interrupt line is triggered by any enabled even numbered interrupt flag, while the odd is triggered by odd flags. the interrupt flags can be set and cleared by software by writing the gpio_ifs and gpio_ifc registers, see example 32.1 (p. 755 ) . since the external interrupts are asynchronous, they are sensitive to noise. to increase noise tolerance, the model and modeh fields in the gpio_px_model and gpio_px_modeh registers, respectively, should be set to include filtering for pins that have external interrupts enabled. example 32.1. interrupt example setting extipsel3 in gpio_extipsell to 2 (port c) and setting the gpio_extirise[3] bit, the interrupt flag ext[3] in gpio_if will be triggered by a rising edge on pin 3 on port c. if ext[3] in gpio_ien is set as well, a interrupt request will be sent on irq_gpio_odd. 32.3.6 output to prs all pins with the same pin number (n) are grouped together to form one prs producer output, giving a total of 16 outputs to the prs. the port on which the output n should be taken is selected by the extipseln[3:0] bits in the gpio_extipsell or the gpio_extipselh registers. 32.3.7 synchronization to avoid metastability in synchronous logic connected to the pins, all inputs are synchronized with double flip-flops. the flip-flops for the input data run on the hfcoreclk. consequently, when a pin changes state, the change will have propagated to gpio_px_din after 2 positive hfcoreclk edges, or maximum 2 hfcoreclk cycles. synchronization (also running on the hfcoreclk) is also added for interrupt input. the input to the prs generation is also synchronized, but these flip-flops run on the hfperclk. to save power when the external interrupts or prs generation is not used, the synchronization flip-flops for these can be turned off by clearing the intsense or prssense, respectively, in gpio_insense register. note to use the gpio, the gpio clock must first be enabled in cmu_hfperclken0. setting this bit enables the hfcoreclk and the hfperclk for the gpio. hfcoreclk is used for updating registers, while hfperclk is only used to synchronize prs and interrupts. the prs and interrupt synchronization can also be disabled through gpio_insense, if these are not used.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 756 www.energymicro.com 32.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 gpio_pa_ctrl rw port control register 0x004 gpio_pa_model rw port pin mode low register 0x008 gpio_pa_modeh rw port pin mode high register 0x00c gpio_pa_dout rw port data out register 0x010 gpio_pa_doutset w1 port data out set register 0x014 gpio_pa_doutclr w1 port data out clear register 0x018 gpio_pa_douttgl w1 port data out toggle register 0x01c gpio_pa_din r port data in register 0x020 gpio_pa_pinlockn rw port unlocked pins register 0x024 gpio_pb_ctrl rw port control register 0x028 gpio_pb_model rw port pin mode low register 0x02c gpio_pb_modeh rw port pin mode high register 0x030 gpio_pb_dout rw port data out register 0x034 gpio_pb_doutset w1 port data out set register 0x038 gpio_pb_doutclr w1 port data out clear register 0x03c gpio_pb_douttgl w1 port data out toggle register 0x040 gpio_pb_din r port data in register 0x044 gpio_pb_pinlockn rw port unlocked pins register 0x048 gpio_pc_ctrl rw port control register 0x04c gpio_pc_model rw port pin mode low register 0x050 gpio_pc_modeh rw port pin mode high register 0x054 gpio_pc_dout rw port data out register 0x058 gpio_pc_doutset w1 port data out set register 0x05c gpio_pc_doutclr w1 port data out clear register 0x060 gpio_pc_douttgl w1 port data out toggle register 0x064 gpio_pc_din r port data in register 0x068 gpio_pc_pinlockn rw port unlocked pins register 0x06c gpio_pd_ctrl rw port control register 0x070 gpio_pd_model rw port pin mode low register 0x074 gpio_pd_modeh rw port pin mode high register 0x078 gpio_pd_dout rw port data out register 0x07c gpio_pd_doutset w1 port data out set register 0x080 gpio_pd_doutclr w1 port data out clear register 0x084 gpio_pd_douttgl w1 port data out toggle register 0x088 gpio_pd_din r port data in register 0x08c gpio_pd_pinlockn rw port unlocked pins register 0x090 gpio_pe_ctrl rw port control register 0x094 gpio_pe_model rw port pin mode low register 0x098 gpio_pe_modeh rw port pin mode high register 0x09c gpio_pe_dout rw port data out register
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 757 www.energymicro.com offset name type description 0x0a0 gpio_pe_doutset w1 port data out set register 0x0a4 gpio_pe_doutclr w1 port data out clear register 0x0a8 gpio_pe_douttgl w1 port data out toggle register 0x0ac gpio_pe_din r port data in register 0x0b0 gpio_pe_pinlockn rw port unlocked pins register 0x0b4 gpio_pf_ctrl rw port control register 0x0b8 gpio_pf_model rw port pin mode low register 0x0bc gpio_pf_modeh rw port pin mode high register 0x0c0 gpio_pf_dout rw port data out register 0x0c4 gpio_pf_doutset w1 port data out set register 0x0c8 gpio_pf_doutclr w1 port data out clear register 0x0cc gpio_pf_douttgl w1 port data out toggle register 0x0d0 gpio_pf_din r port data in register 0x0d4 gpio_pf_pinlockn rw port unlocked pins register 0x100 gpio_extipsell rw external interrupt port select low register 0x104 gpio_extipselh rw external interrupt port select high register 0x108 gpio_extirise rw external interrupt rising edge trigger register 0x10c gpio_extifall rw external interrupt falling edge trigger register 0x110 gpio_ien rw interrupt enable register 0x114 gpio_if r interrupt flag register 0x118 gpio_ifs w1 interrupt flag set register 0x11c gpio_ifc w1 interrupt flag clear register 0x120 gpio_route rw i/o routing register 0x124 gpio_insense rw input sense register 0x128 gpio_lock rw configuration lock register 0x12c gpio_ctrl rw gpio control register 0x130 gpio_cmd w1 gpio command register 0x134 gpio_em4wuen rw em4 wake-up enable register 0x138 gpio_em4wupol rw em4 wake-up polarity register 0x13c gpio_em4wucause r em4 wake-up cause register 32.5 register description 32.5.1 gpio_px_ctrl - port control register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 access rw name drivemode
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 758 www.energymicro.com bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1:0 drivemode 0x0 rw drive mode select select drive mode for all pins on port configured with alternate drive strength. value mode description 0 standard 6 ma drive current 1 lowest 0.5 ma drive current 2 high 20 ma drive current 3 low 2 ma drive current 32.5.2 gpio_px_model - port pin mode low register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw name mode7 mode6 mode5 mode4 mode3 mode2 mode1 mode0 bit name reset access description 31:28 mode7 0x0 rw pin 7 mode configure mode for pin 7. enumeration is equal to mode0. 27:24 mode6 0x0 rw pin 6 mode configure mode for pin 6. enumeration is equal to mode0. 23:20 mode5 0x0 rw pin 5 mode configure mode for pin 5. enumeration is equal to mode0. 19:16 mode4 0x0 rw pin 4 mode configure mode for pin 4. enumeration is equal to mode0. 15:12 mode3 0x0 rw pin 3 mode configure mode for pin 3. enumeration is equal to mode0. 11:8 mode2 0x0 rw pin 2 mode configure mode for pin 2. enumeration is equal to mode0. 7:4 mode1 0x0 rw pin 1 mode configure mode for pin 1. enumeration is equal to mode0. 3:0 mode0 0x0 rw pin 0 mode configure mode for pin 0. value mode description 0 disabled input disabled. pullup if dout is set. 1 input input enabled. filter if dout is set 2 inputpull input enabled. dout determines pull direction 3 inputpullfilter input enabled with filter. dout determines pull direction 4 pushpull push-pull output 5 pushpulldrive push-pull output with drive-strength set by drivemode 6 wiredor wired-or output 7 wiredorpulldown wired-or output with pull-down 8 wiredand open-drain output 9 wiredandfilter open-drain output with filter 10 wiredandpullup open-drain output with pullup 11 wiredandpullupfilter open-drain output with filter and pullup 12 wiredanddrive open-drain output with drive-strength set by drivemode
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 759 www.energymicro.com bit name reset access description value mode description 13 wiredanddrivefilter open-drain output with filter and drive-strength set by drivemode 14 wiredanddrivepullup open-drain output with pullup and drive-strength set by drivemode 15 wiredanddrivepullupfilter open-drain output with filter, pullup and drive-strength set by drivemode 32.5.3 gpio_px_modeh - port pin mode high register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw name mode15 mode14 mode13 mode12 mode11 mode10 mode9 mode8 bit name reset access description 31:28 mode15 0x0 rw pin 15 mode configure mode for pin 15. enumeration is equal to mode8. 27:24 mode14 0x0 rw pin 14 mode configure mode for pin 14. enumeration is equal to mode8. 23:20 mode13 0x0 rw pin 13 mode configure mode for pin 13. enumeration is equal to mode8. 19:16 mode12 0x0 rw pin 12 mode configure mode for pin 12. enumeration is equal to mode8. 15:12 mode11 0x0 rw pin 11 mode configure mode for pin 11. enumeration is equal to mode8. 11:8 mode10 0x0 rw pin 10 mode configure mode for pin 10. enumeration is equal to mode8. 7:4 mode9 0x0 rw pin 9 mode configure mode for pin 9. enumeration is equal to mode8. 3:0 mode8 0x0 rw pin 8 mode configure mode for pin 8. value mode description 0 disabled input disabled. pullup if dout is set. 1 input input enabled. filter if dout is set 2 inputpull input enabled. dout determines pull direction 3 inputpullfilter input enabled with filter. dout determines pull direction 4 pushpull push-pull output 5 pushpulldrive push-pull output with drive-strength set by drivemode 6 wiredor wired-or output 7 wiredorpulldown wired-or output with pull-down 8 wiredand open-drain output 9 wiredandfilter open-drain output with filter 10 wiredandpullup open-drain output with pullup 11 wiredandpullupfilter open-drain output with filter and pullup 12 wiredanddrive open-drain output with drive-strength set by drivemode 13 wiredanddrivefilter open-drain output with filter and drive-strength set by drivemode 14 wiredanddrivepullup open-drain output with pullup and drive-strength set by drivemode 15 wiredanddrivepullupfilter open-drain output with filter, pullup and drive-strength set by drivemode
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 760 www.energymicro.com 32.5.4 gpio_px_dout - port data out register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name dout bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 dout 0x0000 rw data out data output on port. 32.5.5 gpio_px_doutset - port data out set register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access w1 name doutset bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 doutset 0x0000 w1 data out set write bits to 1 to set corresponding bits in gpio_px_dout. bits written to 0 will have no effect. 32.5.6 gpio_px_doutclr - port data out clear register offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access w1 name doutclr
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 761 www.energymicro.com bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 doutclr 0x0000 w1 data out clear write bits to 1 to clear corresponding bits in gpio_px_dout. bits written to 0 will have no effect. 32.5.7 gpio_px_douttgl - port data out toggle register offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access w1 name douttgl bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 douttgl 0x0000 w1 data out toggle write bits to 1 to toggle corresponding bits in gpio_px_dout. bits written to 0 will have no effect. 32.5.8 gpio_px_din - port data in register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access r name din bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 din 0x0000 r data in port data input.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 762 www.energymicro.com 32.5.9 gpio_px_pinlockn - port unlocked pins register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0xffff access rw name pinlockn bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 pinlockn 0xffff rw unlocked pins shows unlocked pins in the port. to lock pin n, clear bit n. the pin is then locked until reset. 32.5.10 gpio_extipsell - external interrupt port select low register offset bit position 0x100 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw name extipsel7 extipsel6 extipsel5 extipsel4 extipsel3 extipsel2 extipsel1 extipsel0 bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:28 extipsel7 0x0 rw external interrupt 7 port select select input port for external interrupt 7. value mode description 0 porta port a pin 7 selected for external interrupt 7 1 portb port b pin 7 selected for external interrupt 7 2 portc port c pin 7 selected for external interrupt 7 3 portd port d pin 7 selected for external interrupt 7 4 porte port e pin 7 selected for external interrupt 7 5 portf port f pin 7 selected for external interrupt 7 27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26:24 extipsel6 0x0 rw external interrupt 6 port select select input port for external interrupt 6. value mode description 0 porta port a pin 6 selected for external interrupt 6 1 portb port b pin 6 selected for external interrupt 6 2 portc port c pin 6 selected for external interrupt 6 3 portd port d pin 6 selected for external interrupt 6 4 porte port e pin 6 selected for external interrupt 6 5 portf port f pin 6 selected for external interrupt 6
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 763 www.energymicro.com bit name reset access description 23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22:20 extipsel5 0x0 rw external interrupt 5 port select select input port for external interrupt 5. value mode description 0 porta port a pin 5 selected for external interrupt 5 1 portb port b pin 5 selected for external interrupt 5 2 portc port c pin 5 selected for external interrupt 5 3 portd port d pin 5 selected for external interrupt 5 4 porte port e pin 5 selected for external interrupt 5 5 portf port f pin 5 selected for external interrupt 5 19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:16 extipsel4 0x0 rw external interrupt 4 port select select input port for external interrupt 4. value mode description 0 porta port a pin 4 selected for external interrupt 4 1 portb port b pin 4 selected for external interrupt 4 2 portc port c pin 4 selected for external interrupt 4 3 portd port d pin 4 selected for external interrupt 4 4 porte port e pin 4 selected for external interrupt 4 5 portf port f pin 4 selected for external interrupt 4 15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14:12 extipsel3 0x0 rw external interrupt 3 port select select input port for external interrupt 3. value mode description 0 porta port a pin 3 selected for external interrupt 3 1 portb port b pin 3 selected for external interrupt 3 2 portc port c pin 3 selected for external interrupt 3 3 portd port d pin 3 selected for external interrupt 3 4 porte port e pin 3 selected for external interrupt 3 5 portf port f pin 3 selected for external interrupt 3 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 extipsel2 0x0 rw external interrupt 2 port select select input port for external interrupt 2. value mode description 0 porta port a pin 2 selected for external interrupt 2 1 portb port b pin 2 selected for external interrupt 2 2 portc port c pin 2 selected for external interrupt 2 3 portd port d pin 2 selected for external interrupt 2 4 porte port e pin 2 selected for external interrupt 2 5 portf port f pin 2 selected for external interrupt 2 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:4 extipsel1 0x0 rw external interrupt 1 port select select input port for external interrupt 1. value mode description 0 porta port a pin 1 selected for external interrupt 1 1 portb port b pin 1 selected for external interrupt 1 2 portc port c pin 1 selected for external interrupt 1 3 portd port d pin 1 selected for external interrupt 1 4 porte port e pin 1 selected for external interrupt 1
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 764 www.energymicro.com bit name reset access description value mode description 5 portf port f pin 1 selected for external interrupt 1 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2:0 extipsel0 0x0 rw external interrupt 0 port select select input port for external interrupt 0. value mode description 0 porta port a pin 0 selected for external interrupt 0 1 portb port b pin 0 selected for external interrupt 0 2 portc port c pin 0 selected for external interrupt 0 3 portd port d pin 0 selected for external interrupt 0 4 porte port e pin 0 selected for external interrupt 0 5 portf port f pin 0 selected for external interrupt 0 32.5.11 gpio_extipselh - external interrupt port select high register offset bit position 0x104 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 access rw rw rw rw rw rw rw rw name extipsel15 extipsel14 extipsel13 extipsel12 extipsel11 extipsel10 extipsel9 extipsel8 bit name reset access description 31 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 30:28 extipsel15 0x0 rw external interrupt 15 port select select input port for external interrupt 15. value mode description 0 porta port a pin 15 selected for external interrupt 15 1 portb port b pin 15 selected for external interrupt 15 2 portc port c pin 15 selected for external interrupt 15 3 portd port d pin 15 selected for external interrupt 15 4 porte port e pin 15 selected for external interrupt 15 5 portf port f pin 15 selected for external interrupt 15 27 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 26:24 extipsel14 0x0 rw external interrupt 14 port select select input port for external interrupt 14. value mode description 0 porta port a pin 14 selected for external interrupt 14 1 portb port b pin 14 selected for external interrupt 14 2 portc port c pin 14 selected for external interrupt 14 3 portd port d pin 14 selected for external interrupt 14 4 porte port e pin 14 selected for external interrupt 14 5 portf port f pin 14 selected for external interrupt 14 23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22:20 extipsel13 0x0 rw external interrupt 13 port select select input port for external interrupt 13.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 765 www.energymicro.com bit name reset access description value mode description 0 porta port a pin 13 selected for external interrupt 13 1 portb port b pin 13 selected for external interrupt 13 2 portc port c pin 13 selected for external interrupt 13 3 portd port d pin 13 selected for external interrupt 13 4 porte port e pin 13 selected for external interrupt 13 5 portf port f pin 13 selected for external interrupt 13 19 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 18:16 extipsel12 0x0 rw external interrupt 12 port select select input port for external interrupt 12. value mode description 0 porta port a pin 12 selected for external interrupt 12 1 portb port b pin 12 selected for external interrupt 12 2 portc port c pin 12 selected for external interrupt 12 3 portd port d pin 12 selected for external interrupt 12 4 porte port e pin 12 selected for external interrupt 12 5 portf port f pin 12 selected for external interrupt 12 15 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 14:12 extipsel11 0x0 rw external interrupt 11 port select select input port for external interrupt 11. value mode description 0 porta port a pin 11 selected for external interrupt 11 1 portb port b pin 11 selected for external interrupt 11 2 portc port c pin 11 selected for external interrupt 11 3 portd port d pin 11 selected for external interrupt 11 4 porte port e pin 11 selected for external interrupt 11 5 portf port f pin 11 selected for external interrupt 11 11 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 10:8 extipsel10 0x0 rw external interrupt 10 port select select input port for external interrupt 10. value mode description 0 porta port a pin 10 selected for external interrupt 10 1 portb port b pin 10 selected for external interrupt 10 2 portc port c pin 10 selected for external interrupt 10 3 portd port d pin 10 selected for external interrupt 10 4 porte port e pin 10 selected for external interrupt 10 5 portf port f pin 10 selected for external interrupt 10 7 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 6:4 extipsel9 0x0 rw external interrupt 9 port select select input port for external interrupt 9. value mode description 0 porta port a pin 9 selected for external interrupt 9 1 portb port b pin 9 selected for external interrupt 9 2 portc port c pin 9 selected for external interrupt 9 3 portd port d pin 9 selected for external interrupt 9 4 porte port e pin 9 selected for external interrupt 9 5 portf port f pin 9 selected for external interrupt 9 3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2:0 extipsel8 0x0 rw external interrupt 8 port select
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 766 www.energymicro.com bit name reset access description select input port for external interrupt 8. value mode description 0 porta port a pin 8 selected for external interrupt 8 1 portb port b pin 8 selected for external interrupt 8 2 portc port c pin 8 selected for external interrupt 8 3 portd port d pin 8 selected for external interrupt 8 4 porte port e pin 8 selected for external interrupt 8 5 portf port f pin 8 selected for external interrupt 8 32.5.12 gpio_extirise - external interrupt rising edge trigger register offset bit position 0x108 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name extirise bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 extirise 0x0000 rw external interrupt n rising edge trigger enable set bit n to enable triggering of external interrupt n on rising edge. value description extirise[n] = 0 rising edge trigger disabled extirise[n] = 1 rising edge trigger enabled 32.5.13 gpio_extifall - external interrupt falling edge trigger register offset bit position 0x10c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name extifall bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 extifall 0x0000 rw external interrupt n falling edge trigger enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 767 www.energymicro.com bit name reset access description set bit n to enable triggering of external interrupt n on falling edge. value description extifall[n] = 0 falling edge trigger disabled extifall[n] = 1 falling edge trigger enabled 32.5.14 gpio_ien - interrupt enable register offset bit position 0x110 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name ext bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 ext 0x0000 rw external interrupt n enable set bit n to enable external interrupt from pin n. value description ext[n] = 0 pin n external interrupt disabled ext[n] = 1 pin n external interrupt enabled 32.5.15 gpio_if - interrupt flag register offset bit position 0x114 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access r name ext bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 ext 0x0000 r external interrupt flag n pin n external interrupt flag. value description ext[n] = 0 pin n external interrupt flag cleared
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 768 www.energymicro.com bit name reset access description value description ext[n] = 1 pin n external interrupt flag set 32.5.16 gpio_ifs - interrupt flag set register offset bit position 0x118 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access w1 name ext bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 ext 0x0000 w1 external interrupt flag n set write bit n to 1 to set interrupt flag n. value description ext[n] = 0 pin n external interrupt flag unchanged ext[n] = 1 pin n external interrupt flag set 32.5.17 gpio_ifc - interrupt flag clear register offset bit position 0x11c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access w1 name ext bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 ext 0x0000 w1 external interrupt flag clear write bit n to 1 to clear external interrupt flag n. value description ext[n] = 0 pin n external interrupt flag unchanged ext[n] = 1 pin n external interrupt flag cleared
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 769 www.energymicro.com 32.5.18 gpio_route - i/o routing register offset bit position 0x120 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0 0 0 0 0 0 0x0 0 1 1 access rw rw rw rw rw rw rw rw rw rw name etmlocation td3pen td2pen td1pen td0pen tclkpen swlocation swopen swdiopen swclkpen bit name reset access description 31:26 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 25:24 etmlocation 0x0 rw i/o location decides the location of the tclk and td pins. value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 3 loc3 location 3 23:17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 td3pen 0 rw etm trace data pin enable enable etm trace data output 3 connection to pin. 15 td2pen 0 rw etm trace data pin enable enable etm trace data output 2 connection to pin. 14 td1pen 0 rw etm trace data pin enable enable etm trace data output 1 connection to pin. 13 td0pen 0 rw etm trace data pin enable enable etm trace data output 0 connection to pin. 12 tclkpen 0 rw etm trace clock pin enable enable etm trace clock output connection to pin. 11:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:8 swlocation 0x0 rw i/o location decides the location of the sw pins. value mode description 0 loc0 location 0 1 loc1 location 1 2 loc2 location 2 3 loc3 location 3 7:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2 swopen 0 rw serial wire viewer output pin enable enable serial wire viewer output connection to pin. 1 swdiopen 1 rw serial wire data pin enable enable serial wire data connection to pin. warning: when this pin is disabled, the device can no longer be accessed by a debugger. a reset will set the pin back to a default state as enabled. if you disable this pin, make sure you have at least a 3 second timeout at the start of you program code before you disable the pin. this way, the debugger will have time to halt the device after a reset before the pin is disabled. 0 swclkpen 1 rw serial wire clock pin enable
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 770 www.energymicro.com bit name reset access description enable serial wire clock connection to pin. warning: when this pin is disabled, the device can no longer be accessed by a debugger. a reset will set the pin back to a default state as enabled. if you disable this pin, make sure you have at least a 3 second timeout at the start of you program code before you disable the pin. this way, the debugger will have time to halt the device after a reset before the pin is disabled. 32.5.19 gpio_insense - input sense register offset bit position 0x124 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 1 1 access rw rw name prs int bit name reset access description 31:2 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 1 prs 1 rw prs sense enable set this bit to enable input sensing for prs. 0 int 1 rw interrupt sense enable set this bit to enable input sensing for interrupts. 32.5.20 gpio_lock - configuration lock register offset bit position 0x128 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x0000 access rw name lockkey bit name reset access description 31:16 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 15:0 lockkey 0x0000 rw configuration lock key write any other value than the unlock code to lock model, modeh, ctrl, pinlockn, episell, eipselh, insense and swdproute from editing. write the unlock code to unlock. when reading the register, bit 0 is set when the lock is enabled. mode value description read operation unlocked 0 gpio registers are unlocked locked 1 gpio registers are locked write operation lock 0 lock gpio registers unlock 0xa534 unlock gpio registers
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 771 www.energymicro.com 32.5.21 gpio_ctrl - gpio control register offset bit position 0x12c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name em4ret bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 em4ret 0 rw enable em4 retention set to enable em4 retention of output enable, output value and pull enable. 32.5.22 gpio_cmd - gpio command register offset bit position 0x130 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name em4wuclr bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 em4wuclr 0 w1 em4 wake-up clear write 1 to clear all wake-up requests. 32.5.23 gpio_em4wuen - em4 wake-up enable register offset bit position 0x134 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name em4wuen bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:0 em4wuen 0x00 rw em4 wake-up enable write 1 to enable wake-up request, write 0 to disable wake-up request.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 772 www.energymicro.com bit name reset access description value mode description 0x01 a0 enable em4 wakeup on pin a0 0x02 a6 enable em4 wakeup on pin a6 0x04 c9 enable em4 wakeup on pin c9 0x08 f1 enable em4 wakeup on pin f1 0x10 f2 enable em4 wakeup on pin f2 0x20 e13 enable em4 wakeup on pin e13 32.5.24 gpio_em4wupol - em4 wake-up polarity register offset bit position 0x138 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name em4wupol bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:0 em4wupol 0x00 rw em4 wake-up polarity write bit n to 1 for high wake-up request. write bit n to 0 for low wake-up request value mode description 0x01 a0 determines polarity on pin a0 0x02 a6 determines polarity on pin a6 0x04 c9 determines polarity on pin c9 0x08 f1 determines polarity on pin f1 0x10 f2 determines polarity on pin f2 0x20 e13 determines polarity on pin e13 32.5.25 gpio_em4wucause - em4 wake-up cause register offset bit position 0x13c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access r name em4wucause bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5:0 em4wucause 0x00 r em4 wake-up cause bit n indicates which pin the wake-up request occurd.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 773 www.energymicro.com bit name reset access description value mode description 0x01 a0 this bit indicates an em4 wake-up request occurd on pin a0 0x02 a6 this bit indicates an em4 wake-up request occurd on pin a6 0x04 c9 this bit indicates an em4 wake-up request occurd on pin c9 0x08 f1 this bit indicates an em4 wake-up request occurd on pin f1 0x10 f2 this bit indicates an em4 wake-up request occurd on pin f2 0x20 e13 this bit indicates an em4 wake-up request occurd on pin e13
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 774 www.energymicro.com 33 lcd - liquid crystal display driver 0 1 2 3 4 lcd driver efm32 quick facts what? the lcd driver can drive up to 8x36 segmented lcd directly. the lcd driver consumes less than 900 na in em2. the animation feature makes it possible to have active animations without cpu intervention. why? segmented lcd displays are common way to display information. the extreme low-power lcd driver enables a lot of applications to utilize an lcd display even in energy critical systems. how? the low frequency clock signal, low-power waveform, animation and blink capabilities enable the lcd driver to run autonomously in em2 for long periods. adding the flexible frame rate setting, contrast control, and different multiplexing modes make the EFM32WG the optimal choice for battery- driven systems with lcd panels. 33.1 introduction the lcd driver is capable of driving a segmented lcd display combination of: 1x40, 2x40, 3x40, 4x40, 6x38 or 8x36 segments. a voltage boost function enables it to provide the lcd display with higher voltage than the supply voltage for the device. in addition, an animation feature can run custom animations on the lcd display without any cpu intervention. the lcd driver can also remain active even in energy mode 2 and provides a frame counter interrupt that can wake-up the device on a regular basis for updating data. 33.2 features ? up to 8x 36 segments. ? configurable multiplexing (1, 2, 3, 4 , 6 , 8 ) ? lcd supports the following com/seg combinations ? 1x40, 2x40, 3x40, 4x40, 6x38, 8x36 ? configurable bias/voltage levels settings ? configurable clock source prescaler ? configurable frame rate ? segment lines can be enabled or disabled individually ? blink capabilities ? integrated animation functionality ? available on seg0-seg7 or seg8-seg15 ? voltage boost capabilities ? possible to run on external power ? programmable contrast
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 775 www.energymicro.com ? frame counter ? lcd frame interrupt ? direct segment control 33.3 functional description an overview of the lcd module is shown in figure 33.1 (p. 775 ) . in its simplest form, an lcd driver would apply a voltage above a certain threshold voltage in order to darken a segment and a voltage below threshold to make a segment clear. however, the lcd display segment will degrade if the applied voltage has a dc-component. to avoid this, the applied waveforms are arranged such that the differential voltage seen by each segment has an average value of zero, and such that the rms voltage (or differential sum of the two waveforms for fast response lcds) is below the segment threshold voltage if the segment shall be transparent, and above the segment threshold voltage when the segment shall be dark. the waveforms are multiplexed between eight (1-8) different common lines and 20-36 segment lines to support up to 288 different lcd segments. the common lines and segment lines can be enabled or disabled individually to prevent the lcd driver from occupying more i/o resources than required. figure 33.1. lcd block diagram lcd volt age generat or v int v ext v boost v lc 1 v lc 0 v lc 1 v lc 0 disable seg out disable com out lcd_segx lcd_comx vlcdsel lcd cont rol and st at us lcd segm ent dat a regist er lcd anim at ion regist ers lcd sequence generat or cont rast and bias set t ing mux and fram erat e set t ing display dat a special effect s lcd_bext dat a bus lfaclk lcd lcd_bcap_p lcd_bcap_n v lc 2 v lc 4 v lc 3 v lc 2 v lc 3 v lc 4 4x 32x seg 4 x seg/com for simplicity, only one segment pin and one common terminal is shown in the figure. 33.3.1 lcd driver enable setting the en bit in lcd_ctrl enables the lcd driver. the mux bit-field in lcd_dispctrl determines which com lines are driven by the lcd driver. by default, lcd_com0 is driven whenever the lcd driver is enabled. the lcd_segen register determines which segment lines are enabled. segment lines can be enabled in groups of 4 and disabled in groups of 4 or individually disabled. to enable output on segment lines 0-7 for instance, the two lowest segment groups, set the two lowest bits in lcd_segen. each lcd segment pin can also be individually disabled by setting the pin to any other state than disabled in the gpio pin configuration.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 776 www.energymicro.com each lcd segment pin can also be individually disabled by setting the pin to any other state than disabled in the gpio pin configuration. 33.3.2 multiplexing, bias, and wave settings the lcd driver supports different multiplexing and bias settings, and these can be set individually in the mux and bias bits in lcd_dispctrl respectively, see table 33.1 (p. 776 ) and table 33.2 (p. 776 ) . note if the mux and bias settings in lcd_dispctrl are changed while the lcd driver is enabled, the output waveform is unpredictable and may lead to a dc-component for one lcd frame. the mux setting determines the number of lcd com lines that are enabled. when using octaplex or sextaplex multiplexing, the additional com lines used (com4-com7) are actually located on the seg (seg20-seg23) lines. when static multiplexing is selected, lcd output is enabled on lcd_com0, when duplex multiplexing is used, lcd_com0-lcd_com1 are used, when triplex multiplexing is selected, lcd_com0-lcd_com2 are used, when quadruplex multiplexing is selected, lcd_com0- lcd_com3 are used, when sextaplex multiplexing is selected, lcd_com0-lcd_com3 together with seg20-seg21 as lcd_com4-lcd_com5 are used, making 38 segments available, located in seg0- seg19, and seg22-seg39. finally when octaplex multiplexing is selected, lcd_com0-lcd_com3 together with seg20-seg23 as lcd_com4-lcd_com7 are used, making the 36 segments available, located in seg0-seg19, and seg24-seg39. see section 33.3.3 (p. 777 ) for waveforms for the different bias and multiplexing settings. the waveforms generated by the lcd controller can be generated in two different versions, regular and low-power. the low power mode waveforms have a lower switching frequency than the regular waveforms, and thus consume less power. the wave bit in lcd_dispctrl decides which waveforms to generate. an example of a low-power waveform is shown in figure 33.2 (p. 777 ) , and an example of a regular waveform is shown in figure 33.3 (p. 777 ) . table 33.1. lcd mux settings muxe mux mode multiplexing 0 00 static static (segments can be multiplexed with lcd_com[0]) 0 01 duplex duplex (segments can be multiplexed with lcd_com[1:0]) 0 10 triplex triplex (segments can be multiplexed with lcd_com[2:0]) 0 11 quadruplex quadruplex (segments can be multiplexed with lcd_com[3:0]) 1 01 sextaplex sextaplex (segments can be multiplexed with lcd_com[3:0] and seg[21:20]) 1 11 octaplex octaplex (segments can be multiplexed with lcd_com[3:0]) and seg[23:20] table 33.2. lcd bias settings bias mode bias setting 00 static static (2 levels) 01 half bias 1/2 bias (3 levels) 10 third bias 1/3 bias (4 levels) 11 fourth bias 1/4 bias (5 levels)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 777 www.energymicro.com table 33.3. lcd wave settings wave mode wave mode 0 lowpower low power optimized waveform output 1 normal regular waveform output figure 33.2. lcd low-power waveform for lcd_com0 in quadruples multiplex mode, 1/3 bias v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 3 ( v ss ) v lc 2 ( 1/3v lcd ) fram e st art fram e end figure 33.3. lcd normal waveform for lcd_com0 in quadruples multiplex mode, 1/3 bias v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 3 ( v ss ) v lc 2 ( 1/3v lcd ) fram e st art fram e end 33.3.3 waveform examples the numbers on the illustration's y-axes in the following sections only indicate different voltage levels. all examples are shown with low-power waveforms. 33.3.3.1 waveforms with static bias and multiplexing ? with static bias and multiplexing, each segment line can be connected to lcd_com0. when the segment line has the same waveform as lcd_com0, the lcd panel pixel is turned off, while when the segment line has the opposite waveform, the lcd panel pixel is turned on. ? dc voltage = 0 (over one frame) ? v rms (on) = v lcd_out ? v rms (off) = 0 (v ss ) figure 33.4. lcd static bias and multiplexing - lcd_com0 fram e st art fram e end v lc 0 (v lcd ) v lc 3 (v ss ) 33.3.3.2 waveforms with 1/2 bias and duplex multiplexing in this mode, each frame is divided into 4 periods. lcd_com[1:0] lines can be multiplexed with all segment lines. figures show 1/2 bias and duplex multiplexing (waveforms show two frames)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 778 www.energymicro.com figure 33.5. lcd 1/2 bias and duplex multiplexing - lcd_com0 v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) v lc 3 ( v ss ) fram e st art fram e end figure 33.6. lcd 1/2 bias and duplex multiplexing - lcd_com1 v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) v lc 3 ( v ss ) fram e st art fram e end 1/2 bias and duplex multiplexing - lcd_seg0 the lcd_seg0 waveform on the left is just an example to illustrate how different segment waveforms can be multiplexed with the lcd_com lines in order to turn on and off lcd pixels. as illustrated in the figures below, this waveform will turn on pixels connected to lcd_com0, while pixels connected to lcd_com1 will be turned off. figure 33.7. lcd 1/2 bias and duplex multiplexing - lcd_seg0 v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) v lc 3 ( v ss ) fram e st art fram e end figure 33.8. lcd 1/2 bias and duplex multiplexing - lcd_seg0 connection com 1 com 0 seg0 1/2 bias and duplex multiplexing - lcd_seg0-lcd_com0 ? dc voltage = 0 (over one frame) ? v rms = 0.79 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com0 will be on with this waveform.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 779 www.energymicro.com figure 33.9. lcd 1/2 bias and duplex multiplexing - lcd_seg0-lcd_com0 v lc 0 ( v lcd ) v lc 3 ( v ss ) -v lc 0 ( v lcd ) fram e st art fram e end v lc 1 ( 1/2v lcd ) -v lc 1 ( 1/2v lcd ) 1/2 bias and duplex multiplexing - lcd_seg0-lcd_com1 ? dc voltage = 0 (over one frame) ? v rms = 0.35 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com0 will be off with this waveform figure 33.10. lcd 1/2 bias and duplex multiplexing - lcd_seg0-lcd_com1 v lc 0 ( v lcd ) v lc 3 ( v ss ) -v lc 0 ( v lcd ) fram e st art fram e end v lc 1 ( 1/2v lcd ) -v lc 1 ( 1/2v lcd ) 33.3.3.3 waveforms with 1/3 bias and duplex multiplexing in this mode, each frame is divided into 4 periods. lcd_com[1:0] lines can be multiplexed with all segment lines. figures show 1/3 bias and duplex multiplexing (waveforms show two frames). figure 33.11. lcd 1/3 bias and duplex multiplexing - lcd_com0 v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 3 ( v ss ) v lc 2 ( 1/3v lcd ) fram e st art fram e end figure 33.12. lcd 1/3 bias and duplex multiplexing - lcd_com1 v lc 0 ( v lcd ) v lc 3 ( v ss ) fram e st art fram e end v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 780 www.energymicro.com 1/3 bias and duplex multiplexing - lcd_seg0 the lcd_seg0 waveform on the left is just an example to illustrate how different segment waveforms can be multiplexed with the com lines in order to turn on and off lcd pixels. as illustrated in the figures below, this waveform will turn on pixels connected to lcd_com0, while pixels connected to lcd_com1 will be turned off. figure 33.13. lcd 1/3 bias and duplex multiplexing - lcd_seg0 v lc 0 ( v lcd ) v lc 3 ( v ss ) fram e st art fram e end v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) figure 33.14. lcd 1/3 bias and duplex multiplexing - lcd_seg0 connection com 1 com 0 seg0 1/3 bias and duplex multiplexing - lcd_seg0-lcd_com0 ? dc voltage = 0 (over one frame) ? v rms = 0.75 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com0 will be on with this waveform figure 33.15. lcd 1/3 bias and duplex multiplexing - lcd_seg0-lcd_com0 v lc 3 ( v ss ) v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) -v lc 0 ( v lcd ) -v lc 1 ( 2/3v lcd ) -v lc 2 ( 1/3v lcd ) fram e st art fram e end 1/3 bias and duplex multiplexing - lcd_seg0-lcd_com0 ? dc voltage = 0 (over one frame) ? v rms = 0.33 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com1 will be off with this waveform
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 781 www.energymicro.com figure 33.16. lcd 1/3 bias and duplex multiplexing - lcd_seg0-lcd_com1 v lc 3 ( v ss ) v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) -v lc 0 ( v lcd ) -v lc 1 ( 2/3v lcd ) -v lc 2 ( 1/3v lcd ) fram e st art fram e end 33.3.3.4 waveforms with 1/2 bias and triplex multiplexing in this mode, each frame is divided into 6 periods. lcd_com[2:0] lines can be multiplexed with all segment lines. figures show 1/2 bias and triplex multiplexing (waveforms show two frames). figure 33.17. lcd 1/2 bias and triplex multiplexing - lcd_com0 v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) v lc 3 ( v ss ) fram e st art fram e end figure 33.18. lcd 1/2 bias and triplex multiplexing - lcd_com1 v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) v lc 3 ( v ss ) fram e st art fram e end figure 33.19. lcd 1/2 bias and triplex multiplexing - lcd_com2 v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) v lc 3 ( v ss ) fram e st art fram e end 1/2 bias and triplex multiplexing - lcd_seg0 the lcd_seg0 waveform on the left is just an example to illustrate how different segment waveforms can be multiplexed with the com lines in order to turn on and off lcd pixels. as illustrated in the figures below, this waveform will turn on pixels connected to lcd_com1, while pixels connected to lcd_com0 and lcd_com2 will be turned off.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 782 www.energymicro.com figure 33.20. lcd 1/2 bias and triplex multiplexing - lcd_seg0 v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) v lc 3 ( v ss ) fram e st art fram e end figure 33.21. lcd 1/2 bias and triplex multiplexing - lcd_seg0 connection com 1 com 2 com 0 seg0 1/2 bias and triplex multiplexing - lcd_seg0-lcd_com0 ? dc voltage = 0 (over one frame) ? v rms = 0.4 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com0 will be off with this waveform figure 33.22. lcd 1/2 bias and triplex multiplexing - lcd_seg0-lcd_com0 v lc 0 ( v lcd ) v lc 3 ( v ss ) -v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) -v lc 1 ( 1/2v lcd ) fram e st art fram e end 1/2 bias and triplex multiplexing - lcd_seg0-lcd_com1 ? dc voltage = 0 (over one frame) ? v rms = 0.7 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com1 will be on with this waveform figure 33.23. lcd 1/2 bias and triplex multiplexing - lcd_seg0-lcd_com1 v lc 0 ( v lcd ) v lc 3 ( v ss ) -v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) -v lc 1 ( 1/2v lcd ) fram e st art fram e end 1/2 bias and triplex multiplexing - lcd_seg0-lcd_com2 ? dc voltage = 0 (over one frame) ? v rms = 0.4 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com2 will be off with this waveform
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 783 www.energymicro.com figure 33.24. lcd 1/2 bias and triplex multiplexing - lcd_seg0-lcd_com2 v lc 0 ( v lcd ) v lc 3 ( v ss ) -v lc 0 ( v lcd ) v lc 1 ( 1/2v lcd ) -v lc 1 ( 1/2v lcd ) fram e st art fram e end 33.3.3.5 waveforms with 1/3 bias and triplex multiplexing in this mode, each frame is divided into 6 periods. lcd_com[2:0] lines can be multiplexed with all segment lines. figures show 1/3 bias and triplex multiplexing (waveforms show two frames). figure 33.25. lcd 1/3 bias and triplex multiplexing - lcd_com0 v lc 0 ( v lcd ) v lc 3 ( v ss ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) fram e st art fram e end figure 33.26. lcd 1/3 bias and triplex multiplexing - lcd_com1 v lc 0 ( v lcd ) v lc 3 ( v ss ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) fram e st art fram e end figure 33.27. lcd 1/3 bias and triplex multiplexing - lcd_com2 v lc 0 ( v lcd ) v lc 3 ( v ss ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) fram e st art fram e end 1/3 bias and triplex multiplexing - lcd_seg0 the lcd_seg0 waveform illustrates how different segment waveforms can be multiplexed with the com lines in order to turn on and off lcd pixels. as illustrated in the figures below, this waveform will turn on pixels connected to lcd_com1, while pixels connected to lcd_com0 and lcd_com2 will be turned off.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 784 www.energymicro.com figure 33.28. lcd 1/3 bias and triplex multiplexing - lcd_seg0 v lc 0 ( v lcd ) v lc 3 ( v ss ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) fram e st art fram e end figure 33.29. lcd 1/3 bias and triplex multiplexing - lcd_seg0 connection com 1 com 2 com 0 seg0 1/3 bias and triplex multiplexing - lcd_seg0-lcd_com0 ? dc voltage = 0 (over one frame) ? v rms = 0.33 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com0 will be off with this waveform figure 33.30. lcd 1/3 bias and triplex multiplexing - lcd_seg0-lcd_com0 v lc 3 ( v ss ) v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) -v lc 0 ( v lcd ) -v lc 1 ( 2/3v lcd ) -v lc 2 ( 1/3v lcd ) fram e st art fram e end 1/3 bias and triplex multiplexing - lcd_seg0-lcd_com1 ? dc voltage = 0 (over one frame) ? v rms = 0.64 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com1 will be on with this waveform figure 33.31. lcd 1/3 bias and triplex multiplexing - lcd_seg0-lcd_com1 v lc 3 ( v ss ) v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) -v lc 0 ( v lcd ) -v lc 1 ( 2/3v lcd ) -v lc 2 ( 1/3v lcd ) fram e st art fram e end
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 785 www.energymicro.com 1/3 bias and triplex multiplexing - lcd_seg0-lcd_com2 ? dc voltage = 0 (over one frame) ? v rms = 0.33 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com2 will be off with this waveform figure 33.32. lcd 1/3 bias and triplex multiplexing - lcd_seg0-lcd_com2 v lc 3 ( v ss ) v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) -v lc 0 ( v lcd ) -v lc 1 ( 2/3v lcd ) -v lc 2 ( 1/3v lcd ) fram e st art fram e end 33.3.3.6 waveforms with 1/3 bias and quadruplex multiplexing in this mode, each frame is divided into 8 periods. all com lines can be multiplexed with all segment lines. figures show 1/3 bias and quadruplex multiplexing (waveforms show two frames). figure 33.33. lcd 1/3 bias and quadruplex multiplexing - lcd_com0 v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 3 ( v ss ) v lc 2 ( 1/3v lcd ) fram e st art fram e end figure 33.34. lcd 1/3 bias and quadruplex multiplexing - lcd_com1 v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 3 ( v ss ) v lc 2 ( 1/3v lcd ) fram e st art fram e end figure 33.35. lcd 1/3 bias and quadruplex multiplexing - lcd_com2 v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 3 ( v ss ) v lc 2 ( 1/3v lcd ) fram e st art fram e end
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 786 www.energymicro.com figure 33.36. lcd 1/3 bias and quadruplex multiplexing - lcd_com3 v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 3 ( v ss ) v lc 2 ( 1/3v lcd ) fram e st art fram e end 1/3 bias and quadruplex multiplexing - lcd_seg0 the lcd_seg0 waveform on the left is just an example to illustrate how different segment waveforms can be multiplexed with the com lines in order to turn on and off lcd pixels. as illustrated in the figures below, this wave form will turn on pixels connected to lcd_com0 and lcd_com2, while pixels connected to lcd_com1 and lcd_com3 will be turned off. figure 33.37. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0 v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 3 ( v ss ) v lc 2 ( 1/3v lcd ) fram e st art fram e end figure 33.38. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0 connection com 1 com 2 com 3 com 0 seg0 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com0 ? dc voltage = 0 (over one frame) ? v rms = 0.58 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com0 will be on with this waveform figure 33.39. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com0 v lc 3 ( v ss ) v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) -v lc 0 ( v lcd ) -v lc 1 ( 2/3v lcd ) -v lc 2 ( 1/3v lcd ) fram e st art fram e end 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com1 ? dc voltage = 0 (over one frame)
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 787 www.energymicro.com ? v rms = 0.33 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com1 will be off with this waveform figure 33.40. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com1 v lc 3 ( v ss ) v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) -v lc 0 ( v lcd ) -v lc 1 ( 2/3v lcd ) -v lc 2 ( 1/3v lcd ) fram e st art fram e end 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com2 ? dc voltage = 0 (over one frame) ? v rms = 0.58 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com2 will be on with this waveform figure 33.41. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com2 v lc 3 ( v ss ) v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) -v lc 0 ( v lcd ) -v lc 1 ( 2/3v lcd ) -v lc 2 ( 1/3v lcd ) fram e st art fram e end 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com2 ? dc voltage = 0 (over one frame) ? v rms = 0.33 v lcd_out ? the lcd display pixel that is connected to lcd_seg0 and lcd_com3 will be off with this waveform figure 33.42. lcd 1/3 bias and quadruplex multiplexing- lcd_seg0-lcd_com3 v lc 3 ( v ss ) v lc 0 ( v lcd ) v lc 1 ( 2/3v lcd ) v lc 2 ( 1/3v lcd ) -v lc 0 ( v lcd ) -v lc 1 ( 2/3v lcd ) -v lc 2 ( 1/3v lcd ) fram e st art fram e end 33.3.4 lcd contrast different lcd panels have different characteristics and also temperature may affect the characteristics of the lcd panels. to compensate for such variations, the lcd driver has a programmable contrast that
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 788 www.energymicro.com adjusts the v lcd_out . the contrast is set by conlev in lcd_dispctrl, and can be adjusted relative to either v dd (v lcd ) or ground using conconf in lcd_dispctrl. see table 33.4 (p. 788 ) and table 33.5 (p. 788 ) , table 33.5 (p. 788 ) and table 33.6 (p. 789 ) . table 33.4. lcd contrast bias conlev equation range 00 00000-11111 v lcd_out = v lcd x (0.61 x (1 + conlev/(2 5 - 1))) conlev = 0 => v lcd_out = 0.61v lcd conlev = 31 => v lcd_out = v lcd 01 00000-11111 v lcd_out = v lcd x (0.53 x (1 + conlev/(2 5 - 1))) conlev = 0 => v lcd_out = 0.53v lcd conlev = 31 => v lcd_out = v lcd 10 00000-11111 v lcd_out = v lcd x (0.61 x (1 + conlev/(2 5 - 1))) conlev = 0 => v lcd_out = 0.61v lcd conlev = 31 => v lcd_out = v lcd 11 00000-11111 v lcd_out = v lcd x (0.61 x (1 + conlev/(2 5 - 1))) conlev = 0 => v lcd_out = 0.61v lcd conlev = 31 => v lcd_out = v lcd note reset value is maximum contrast table 33.5. lcd contrast function conconf function 0 contrast is adjusted relative to v dd (v lcd ) 1 contrast is adjusted relative to ground
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 789 www.energymicro.com table 33.6. lcd principle of contrast adjustment for different bias settings. contrast adjustment relative to v dd (v lcd ) (conconf = 0) contrast adjustment relative to gnd (conconf = 1) no contrast adjustment (conlev = 11111) 1/4 bias v lc 0 v lc 1 v lc 2 v lc 3 r0 r1 r2 rx v lcd _ out v lcd r3 v lc 4 v lc 0 v lc 1 v lc 2 v lc 3 r0 r1 r2 v lcd rx v lcd _ out r3 v lc 4 v lc 0 v lc 1 v lc 2 v lc 3 r0 r1 r2 v lcd v lcd _ out r3 v lc 4 1/3 bias v lc 0 v lc 1 v lc 2 v lc 3 r0 r1 r2 rx v lcd _ out v lcd v lc 0 v lc 1 v lc 2 v lc 3 r0 r1 r2 v lcd rx v lcd _ out v lc 0 v lc 1 v lc 2 v lc 3 r0 r1 r2 v lcd v lcd _ out 1/2 bias v lc 0 v lc 1 v lc 3 v lcd r0 r1 rx v lcd _ out v lc 0 v lc 1 v lc 3 v lcd r0 r1 rx v lcd _ out v lc 0 v lc 1 v lc 3 v lcd r0 r1 v lcd _ out static v lc 0 v lc 3 v lcd r0 rx v lcd _ out v lc 0 v lc 3 r0 v lcd rx v lcd _ out v lc 0 v lc 3 v lcd v lcd _ out r0 = r1 = r2 = r3 in the figure, while rx is adjusted by changing the conlev bits. 33.3.5 v lcd selection by default, the lcd driver runs on main external power (v lcd = v dd ), see table 33.7 (p. 790 ) . an internal boost circuit can be enabled by setting vboosten in cmu_lcdctrl and selecting the boosted voltage by setting vlcdsel in lcd_dispctrl. this will boosts v lcd to v boost . v boost can be selected in the range of 3.0 v ? 3.6 v by configuring vblev in lcd_dispctrl. note that the boost circuit is not designed to operate with the selected boost voltage, v boost , smaller than v dd . the boost circuit can boost the v lcd up to 3.6 v when v dd is as low as 2.0 v. when using the voltage booster, the lcd_bext pin must be connected through a 1 f capacitor to vss, and the lcd_bcap_p and lcd_bcap_n pins must be connected to each other through a 22 nf capacitor.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 790 www.energymicro.com it is also possible to connect a dedicated power supply to the lcd module. the lcd external power supply must be connected to the lcd_bext pin and vlcdsel in lcd_dispctrl must be set. in this mode, the voltage booster should be disabled. table 33.7. lcd v lcd vlcdsel mode v lcd 0 vdd v dd (same as main external power) 1 vboost voltage booster/external v dd 33.3.6 vboost control the boost voltage is configurable. by programming the vblev bits in lcd_dispctrl, the boost voltage level can be adjusted between 3.0v and 3.6v. the boost circuit will use an update frequency given by the vbfdiv bits in cmu_lcdctrl, see table 33.8 (p. 790 ) ). it is possible to adjust the frequency to optimize performance for all kinds of lcd panels (large capacitors may require less frequent updates, while small capacitors may require more frequent updates). a lower update frequency would in general lead to smaller current consumption. table 33.8. lcd v boost frequency vbfdiv v boost update frequency 000 lfaclk 001 lfaclk/2 010 lfaclk/4 011 lfaclk/8 100 lfaclk/16 101 lfaclk/32 110 lfaclk/64 111 lfaclk/128 33.3.7 frame rate it is important to choose the correct frame rate for the lcd display. normally, the frame rate should be between 30 and 100 hz. a frame rate below 30 hz may lead to flickering, while a frame rate above 100 hz may lead to ghostering and unnecessarily high power consumption. 33.3.7.1 clock selection and prescaler the lfaclk is prescaled to lfaclk lcdpre in the cmu. the available prescaler settings are: ? lfclk16: lfaclk lcdpre = lfaclk/16 ? lfclk32: lfaclk lcdpre = lfaclk/32 ? lfclk64: lfaclk lcdpre = lfaclk/64 ? lfclk128: lfaclk lcdpre = lfaclk/128 in addition to selecting the correct prescaling, the clock source can be selected in the cmu. to use this module, the le interface clock must be enabled in cmu_hfcoreclken0, in addition to the module clock.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 791 www.energymicro.com 33.3.7.2 frame rate division register the frame rate is set in the cmu by programming the frame rate division bits fdiv in cmu_lcdctrl. this setting should not be changed while the lcd driver is running. the equation for calculating the resulting frame rate is given from equation 33.1 (p. 791 ) lcd frame rate calculation lfaclk lcd = lfaclk lcdpre /(1 + fdiv) (33.1) table 33.9. lcd frame rate conversion table resulting frame rate, clk frame (hz) lfaclk lcdpre = 2 khz lfaclk lcdpre = 1 khz lfaclk lcdpre = 0.5 khz lfaclk lcdpre = 0.25 khz mux mode frame- rate formula min max min max min max min max static lfaclk lcd /2 128 1024 64 512 32 256 16 128 duplex lfaclk lcd /4 64 512 32 256 16 128 8 64 triplex lfaclk lcd /6 43 341 21 171 11 85 5 43 quadruplex lfaclk lcd /8 32 256 16 128 8 64 4 32 sextaplex lfaclk lcd /12 21.33 170.67 10.67 85.33 5.33 42.67 2.67 21.33 octaplex lfaclk lcd /16 16 128 8 64 4 32 2 16 table settings: min: fdiv = 7, max: fdiv = 0 33.3.8 data update the lcd driver logic that controls the output waveforms is clocked on lfaclk lcdpre . the lcd data and control registers are clocked on the hfcoreclk. to avoid metastability and unpredictable behavior, the data in the segment data (segdn) registers must be synchronized to the lcd driver logic. also, it is important that data is updated at the beginning of an lcd frame since the segment waveform depends on the segment data and a change in the middle of a frame may lead to a dc-component in that frame. the lcd driver has dedicated functionality to synchronize data transfer to the lcd frames. the synchronization logic is applied to all data that need to be updated at the beginning of the lcd frames: ? lcd_segdn ? lcd_arega ? lcd_aregb ? lcd_bactrl the different methods to update data are controlled by the udctrl bits in lcd_ctrl. table 33.10. lcd update data control (udctrl) bits udctrl mode description 00 regular the data transfer is controlled by sw and data synchronization is initiated by writing data to the buffers. data is transferred as soon as possible, possibly creating a frame with a dc component on the lcd. 01 fcevent the data transfer is done at the next event triggered by the frame counter (fc). see section 33.3.10 (p. 792 ) for details on how to configure the frame counter. optionally, the frame counter can also generate an interrupt at every event. 10 framestart the data transfer is done at frame-start.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 792 www.energymicro.com 33.3.9 direct segment control (dsc) it is possible to gain direct control over the bias levels for each seg/com line by setting dsc in lcd_ctrl, overwriting the bias settings in lcd_dispctrl. the seg lines bias levels can be set in segd0-segd3, while the com line bias levels can be set in segd4. to represent the different bias levels, 2-bits per seg lines are needed. for example, seg0's bias levels can be set using segd0[1:0], and seg1 can be controlled through segd0[3:2] etc. bias level encoding is shown in table 33.11 (p. 792 ) . table 33.11. dsc bias encoding segd mode bias setting 00 static static (2 levels) 01 half bias 1/2 bias (3 levels) 10 third bias 1/3 bias (4 levels) 11 fourth bias 1/4 bias (5 levels) 33.3.10 frame counter (fc) the frame counter is synchronized to the lcd frame start and will generate an event after a programmable number of frames. an fc event can trigger: ? lcd ready interrupt ? blink (controlling the blink frequency) ? next state in the animation state machine ? data update if udctrl = 01 the frame counter is a down counter. it is enabled by writing fcen in lcd_bactrl. optionally, the frame counter can be prescaled so that the frame counter is decremented at: ? every frame ? every second frame ? every fourth frame ? every eight frame this is controlled by the fcpresc in lcd_bactrl, see table 33.12 (p. 792 ) table 33.12. fcpresc fcpresc mode description general equation 00 div1 clk frame /1 01 div2 clk frame /2 10 div4 clk frame /4 11 div8 clk frame /8 clk fc = clk frame /2 fcpresc the top value for the frame counter is set by fctop in lcd_bactrl. every time the frame counter reaches zero, it is reloaded with the top value, and at the same time an event, which can cause an interrupt, data update, blink, or an animation state transition is triggered. lcd event frequency equation
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 793 www.energymicro.com clk event = clk fc /(1 + fctop[5:0]) hz (33.2) the above equation shows how to set-up the lcd event frequency. in this example, the frame rate is 64hz, and the lcd event frequency should be set-up to 2 seconds. example 33.1. lcd event frequency example ? write fcpresc to 3 => clk fc = 8hz (0.125 seconds) ? write fctop to 15 => clk event = 0.5hz (2 seconds) if higher resolution is required, configure a lower prescaler value and increase the fcpresc in lcd_bactrl accordingly (e.g. fcpresc = 2, fctop = 31). figure 33.43. lcd clock system in lcd driver lfxo lfrco count er fdiv[ 2:0] lcd fram e count er fctop[ 5:0] lfaclk lcdpre clk fc clk event div2 clk frame mux in lcd _dispctrl lfaclk lcd lcd in cmu _lfapresc0 cmu div16 div32 div64 div128 div1 div2 div4 div8 fcpresc in lcd _bactrl lfaclk div4 div6 div8 div12 div16 st at ic duplex t riplex quadruplex sext aplex oct aplex 33.3.11 lcd interrupt the lcd interrupt can be used to synchronize data update. the fc interrupt flag is set at every lcd frame counter event, which must be set-up separately. the interrupt is enabled by setting fc bit in lcd_ien. 33.3.12 blink, blank, and animation features 33.3.12.1 blink the lcd driver can be configured to blink, alternating all enabled segments between on and off. the blink frequency is given by the clk event frequency, see section 33.3.10 (p. 792 ) . see section 33.3.8 (p. 791 ) for details regarding synchronization of the blink feature. the fc must be on for blink to work. 33.3.12.2 blank setting blank in lcd_bactrl will output the ?off? waveform on all enabled segments, effectively blanking the entire display. writing the blank bit to zero disables the blanking and segment data will be output as normal. see section 33.3.8 (p. 791 ) for details regarding synchronization of blank. 33.3.12.3 animation state machine the animation state machine makes it possible to enable different animations without updating the data registers, allowing specialized patterns running on the lcd panel while the microcontroller remains in
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 794 www.energymicro.com low energy mode and thus saving power consumption. the animation feature is available on 8 segments multiplexed with lcd_com0. the 8 segments can be either segments 0 to 7 or 8 to 15, depending on aloc in lcd_bactrl. the animation is implemented as two programmable 8 bits registers that are shifted left or right every other animation state for a total of 16 states. the shift operations applied to the shift registers are controlled by aregasc and aregbsc in lcd_bactrl as shown in the table below. note also that the fc must be on for animation to work, as it is the fc event that drives the animation state machine. table 33.13. lcd animation shift register aregnsc, n = a or b mode description 00 noshift no shift operation 01 shiftleft animation register is shifted left (lcd_arega is shifted every odd state, lcd_aregb is shifted every even state) 10 shiftright animation register is shifted right (lcd_arega is shifted every odd state, lcd_aregb is shifted every even state) 11 reserved reserved the two registers are either or?ed or and?ed to achieve the displayed animation pattern. this is controlled by alogsel in lcd_bactrl as shown in table 33.14 (p. 794 ) . in addition, the regular segment data segd0[7:0] / segd0[15:8] is or?ed with the animation pattern to generate the resulting output. table 33.14. lcd animation pattern alogsel mode description 0 and lcd_arega and lcd_aregb are and?ed together 1 or lcd_arega and lcd_aregb are or?ed together each state is displayed one clk event period, see section 33.3.10 (p. 792 ) . by reading astate in lcd_status, software can identify which state that is currently active in the state sequence. note that the shifting operation is performed on internal registers that are not accessible in sw (when reading lcd_arega and lcd_aregb, the data that was original written will also be read back). the sw must utilize the knowledge about the current state (astate) to calculate what is currently output. astate is cleared when lcd_arega or lcd_aregb are updated with new values. see table 33.15 (p. 795 ) for an example.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 795 www.energymicro.com table 33.15. lcd animation example astate lcd_arega lcd_aregb resulting data 0 11000000 11000000 11000000 1 01100000 11000000 11100000 2 01100000 01100000 01100000 3 00110000 01100000 01110000 4 00110000 00110000 00110000 5 00011000 00110000 00111000 6 00011000 00011000 00011000 7 00001100 00011000 00011100 8 00001100 00001100 00001100 9 00000110 00001100 00001110 10 00000110 00000110 00000110 11 00000011 00000110 00000111 12 00000011 00000011 00000011 13 10000001 00000011 10000011 14 10000001 10000001 10000001 15 11000000 10000001 11000001 in the table, aregasc = 10, aregbsc = 10, alogsel = 1 and the resulting data is to be displayed on segment lines 7-0 or 15-8 multiplexed with lcd_com0. figure 33.44. lcd block diagram of the animation circuit arega aregb aregasc = 1 = > shift left aregasc = 2 = > shift right odd anim at ion st at es aregbsc = 1 = > shift left aregbsc = 2 = > shift right even anim at ion st at es alogsel dat a out [ 7:0] / [ 15:8] clk event segd0[ 7:0] / segd0[ 15:8]
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 796 www.energymicro.com example 33.2. lcd animation enable example ? write data into the animation registers lcd_arega, lcd_aregb ? enable the correct shift direction (if any) ? decide which logical function to perform on the registers ? alogsel = 0: data_out = lcd_arega & lcd_aregb ? alogsel = 1:data_out = lcd_arega | lcd_aregb ? configure the right animation period (clk event ) ? enable the animation pattern and frame counter (aen = 1, fcen = 1) for updating data in the lcd while it is running an animation, and the new animation data depends on the pattern visible on the lcd, see the following example. example 33.3. lcd animation dependence example ? enable the lcd interrupt (the interrupt will be triggered simultaneously as the animation state machine changes state) ? in the interrupt handler, read back the current state (astate) ? knowing the current state of the animation state machine makes it possible to calculate what data that is currently output ? modify data as required (data will be updated at the next frame counter event). it is important that new data is written before the next frame counter event. 33.3.13 lcd in low energy modes as long as the lfaclk is running (em0-em2), the lcd controller continues to output lcd waveforms according to the data that is currently synchronized to the lcd driver logic. in addition, the following features are still active if enabled: ? animation state machine ? blink ? lcd event interrupt 33.3.14 register access since this module is a low energy peripheral, and runs off a clock which is asynchronous to the hfcoreclk, special considerations must be taken when accessing registers. please refer to section 5.3 (p. 21 ) for a description on how to perform register accesses to low energy peripherals.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 797 www.energymicro.com 33.4 register map the offset register address is relative to the registers base address. offset name type description 0x000 lcd_ctrl rw control register 0x004 lcd_dispctrl rw display control register 0x008 lcd_segen rw segment enable register 0x00c lcd_bactrl rw blink and animation control register 0x010 lcd_status r status register 0x014 lcd_arega rw animation register a 0x018 lcd_aregb rw animation register b 0x01c lcd_if r interrupt flag register 0x020 lcd_ifs w1 interrupt flag set register 0x024 lcd_ifc w1 interrupt flag clear register 0x028 lcd_ien rw interrupt enable register 0x040 lcd_segd0l rw segment data low register 0 0x044 lcd_segd1l rw segment data low register 1 0x048 lcd_segd2l rw segment data low register 2 0x04c lcd_segd3l rw segment data low register 3 0x050 lcd_segd0h rw segment data high register 0 0x054 lcd_segd1h rw segment data high register 1 0x058 lcd_segd2h rw segment data high register 2 0x05c lcd_segd3h rw segment data high register 3 0x060 lcd_freeze rw freeze register 0x064 lcd_syncbusy r synchronization busy register 0x0b4 lcd_segd4h rw segment data high register 4 0x0b8 lcd_segd5h rw segment data high register 5 0x0bc lcd_segd6h rw segment data high register 6 0x0c0 lcd_segd7h rw segment data high register 7 0x0cc lcd_segd4l rw segment data low register 4 0x0d0 lcd_segd5l rw segment data low register 5 0x0d4 lcd_segd6l rw segment data low register 6 0x0d8 lcd_segd7l rw segment data low register 7 33.5 register description 33.5.1 lcd_ctrl - control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 798 www.energymicro.com offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 0 access rw rw rw name dsc udctrl en bit name reset access description 31:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23 dsc 0 rw direct segment control this bit enables direct control over bias levels for each seg/com line. value description 0 dsc disable 1 dsc enable 22:3 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 2:1 udctrl 0x0 rw update data control these bits control how data from the segdn registers are transferred to the lcd driver. value mode description 0 regular the data transfer is controlled by sw. transfer is performed as soon as possible 1 fcevent the data transfer is done at the next event triggered by the frame counter 2 framestart the data transfer is done continuously at every lcd frame start 0 en 0 rw lcd enable when this bit is set, the lcd driver is enabled and the driver will start outputting waveforms on the com/segment lines. 33.5.2 lcd_dispctrl - display control register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x3 0 0 0x1f 0 0x0 0x0 access rw rw rw rw rw rw rw rw name muxe vblev vlcdsel conconf conlev wave bias mux bit name reset access description 31:23 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 22 muxe 0 rw extended mux configuration this bit redefines the meaning of the mux field. value mode description 0 mux multiplex mode determined by mux field. 1 muxe mux extended mode. extends the meaning of the mux field. 21 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 20:18 vblev 0x3 rw voltage boost level these bits control voltage boost level. please refer to datasheet for further details of the boost levels.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 799 www.energymicro.com bit name reset access description value mode description 0 level0 minimum boost level 1 level1 2 level2 3 level3 4 level4 5 level5 6 level6 7 level7 maximum boost level 17 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 16 vlcdsel 0 rw v lcd selection this bit controls which voltage source that is connected to v lcd . value mode description 0 vdd vdd 1 vextboost voltage booster/external vdd 15 conconf 0 rw contrast configuration this bit selects whether the contrast adjustment is done relative to v lcd or ground. value mode description 0 vlcd contrast is adjusted relative to v lcd 1 gnd contrast is adjusted relative to ground 14:13 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 12:8 conlev 0x1f rw contrast level these bits control the contrast setting according to this formula: v lcd_out = v lcd 0.5(1+conlev/31). value mode description 0 min minimum contrast 31 max maximum contrast 7:5 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 4 wave 0 rw waveform selection this bit configures the output waveform. value mode description 0 lowpower low power waveform 1 normal normal waveform 3:2 bias 0x0 rw bias configuration these bits set the bias mode for the lcd driver. value mode description 0 static static 1 onehalf 1/2 bias 2 onethird 1/3 bias 3 onefourth 1/4 bias 1:0 mux 0x0 rw mux configuration these bits set the multiplexing mode for the lcd driver. the field is dependent on the value of muxe field mux muxe mode description 0 0 static static. uses com line lcd_com0. 1 0 duplex duplex. uses com lines lcd_com0- lcd_com1. 2 0 triplex triplex. uses com lines lcd_com0- lcd_com2. 3 0 quadruplex quadruplex. uses com lines lcd_com0- lcd_com3.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 800 www.energymicro.com bit name reset access description mux muxe mode description 1 1 sextaplex sextaplex. uses com lines lcd_com0- lcd_com5. 3 1 octaplex octaplex. uses com lines lcd_com0- lcd_com7. 33.5.3 lcd_segen - segment enable register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x000 access rw name segen bit name reset access description 31:10 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 9:0 segen 0x000 rw segment enable determines which segment lines are enabled. each bit represents a group of 4 segment lines. to enable segment lines x to x+3, set bit x/4, i.e. to enable output on segment lines 4,5,6 and 7, set bit 1. each lcd segment pin can also be individually disabled by setting the pin to any other state than disabled in the gpio pin configuration. 33.5.4 lcd_bactrl - blink and animation control register (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x00 0x0 0 0 0x0 0x0 0 0 0 access rw rw rw rw rw rw rw rw rw rw name aloc fctop fcpresc fcen alogsel aregbsc aregasc aen blank blinken bit name reset access description 31:29 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 28 aloc 0 rw animation location set the lcd segments which animation applies to value mode description 0 seg0to7 animation appears on segments 0 to 7 1 seg8to15 animation appears on segments 8 to 15 27:24 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 23:18 fctop 0x00 rw frame counter top value these bits contain the top value for the frame counter: clk event = clk fc / (1 + fctop[5:0]).
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 801 www.energymicro.com bit name reset access description 17:16 fcpresc 0x0 rw frame counter prescaler these bits controls the prescaling value for the frame counter input clock. value mode description 0 div1 clk fc = clk frame / 1 1 div2 clk fc = clk frame / 2 2 div4 clk fc = clk frame / 4 3 div8 clk fc = clk frame / 8 15:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 fcen 0 rw frame counter enable when this bit is set, the frame counter is enabled. 7 alogsel 0 rw animate logic function select when this bit is set, the animation registers are and'ed together. when this bit is cleared, the animation registers are or'ed together. value mode description 0 and arega and aregb and'ed 1 or arega and aregb or'ed 6:5 aregbsc 0x0 rw animate register b shift control these bits controls the shift operation that is performed on animation register b. value mode description 0 noshift no shift operation on animation register b 1 shiftleft animation register b is shifted left 2 shiftright animation register b is shifted right 4:3 aregasc 0x0 rw animate register a shift control these bits controls the shift operation that is performed on animation register a. value mode description 0 noshift no shift operation on animation register a 1 shiftleft animation register a is shifted left 2 shiftright animation register a is shifted right 2 aen 0 rw animation enable when this bit is set, the animate function is enabled. 1 blank 0 rw blank display when this bit is set, all segment output waveforms are configured to blank the lcd display. the segment data registers are not affected when writing this bit. value description 0 display is not "blanked" 1 display is "blanked" 0 blinken 0 rw blink enable when this bit is set, the blink function is enabled. every "on" segment will alternate between on and off at every frame counter event. 33.5.5 lcd_status - status register offset bit position 0x010 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0x0 access r r name blink astate
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 802 www.energymicro.com bit name reset access description 31:9 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 8 blink 0 r blink state this bits indicates the blink status. if this bit is 1, all segments are off. if this bit is 0, the segments(lcd_segdxn) which are set to 1 are on. 7:4 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 3:0 astate 0x0 r current animation state contains the current animation state (0-15). 33.5.6 lcd_arega - animation register a (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x014 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name arega bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 arega 0x00 rw animation register a data this register contains the a data for generating animation pattern. 33.5.7 lcd_aregb - animation register b (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x018 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name aregb bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 aregb 0x00 rw animation register b data this register contains the b data for generating animation pattern.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 803 www.energymicro.com 33.5.8 lcd_if - interrupt flag register offset bit position 0x01c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access r name fc bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 fc 0 r frame counter interrupt flag set when frame counter is zero. 33.5.9 lcd_ifs - interrupt flag set register offset bit position 0x020 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name fc bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 fc 0 w1 frame counter interrupt flag set write to 1 to set fc interrupt flag. 33.5.10 lcd_ifc - interrupt flag clear register offset bit position 0x024 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access w1 name fc bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 fc 0 w1 frame counter interrupt flag clear write to 1 to clear fc interrupt flag.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 804 www.energymicro.com 33.5.11 lcd_ien - interrupt enable register offset bit position 0x028 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name fc bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 fc 0 rw frame counter interrupt enable set to enable interrupt on frame counter interrupt flag. 33.5.12 lcd_segd0l - segment data low register 0 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name segd0l bit name reset access description 31:0 segd0l 0x00000000 rw com0 segment data low this register contains segment data for segment lines 0-31 for com0. 33.5.13 lcd_segd1l - segment data low register 1 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 805 www.energymicro.com offset bit position 0x044 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name segd1l bit name reset access description 31:0 segd1l 0x00000000 rw com1 segment data low this register contains segment data for segment lines 0-31 for com1. 33.5.14 lcd_segd2l - segment data low register 2 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x048 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name segd2l bit name reset access description 31:0 segd2l 0x00000000 rw com2 segment data low this register contains segment data for segment lines 0-31 for com2. 33.5.15 lcd_segd3l - segment data low register 3 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 806 www.energymicro.com offset bit position 0x04c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name segd3l bit name reset access description 31:0 segd3l 0x00000000 rw com3 segment data low this register contains segment data for segment lines 0-31 for com3. 33.5.16 lcd_segd0h - segment data high register 0 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x050 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name segd0h bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 segd0h 0x00 rw com0 segment data high this register contains segment data for segment lines 32-39 for com0. 33.5.17 lcd_segd1h - segment data high register 1 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x054 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name segd1h
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 807 www.energymicro.com bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 segd1h 0x00 rw com1 segment data high this register contains segment data for segment lines 32-39 for com1. 33.5.18 lcd_segd2h - segment data high register 2 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x058 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name segd2h bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 segd2h 0x00 rw com2 segment data high this register contains segment data for segment lines 32-39 for com2. 33.5.19 lcd_segd3h - segment data high register 3 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x05c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name segd3h bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 segd3h 0x00 rw com3 segment data high this register contains segment data for segment lines 32-39 for com3.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 808 www.energymicro.com 33.5.20 lcd_freeze - freeze register offset bit position 0x060 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 access rw name regfreeze bit name reset access description 31:1 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 0 regfreeze 0 rw register update freeze when set, the update of the lcd is postponed until this bit is cleared. use this bit to update several registers simultaneously. value mode description 0 update each write access to an lcd register is updated into the low frequency domain as soon as possible. 1 freeze the lcd is not updated with the new written value. 33.5.21 lcd_syncbusy - synchronization busy register offset bit position 0x064 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 access r r r r r r r r r r r r r r r r r r r r name segd7l segd6l segd5l segd4l segd7h segd6h segd5h segd4h segd3h segd2h segd1h segd0h segd3l segd2l segd1l segd0l aregb arega bactrl ctrl bit name reset access description 31:20 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 19 segd7l 0 r segd7l register busy set when the value written to segd7l is being synchronized. 18 segd6l 0 r segd6l register busy set when the value written to segd6l is being synchronized. 17 segd5l 0 r segd5l register busy set when the value written to segd5l is being synchronized. 16 segd4l 0 r segd4l register busy set when the value written to segd4l is being synchronized. 15 segd7h 0 r segd7h register busy set when the value written to segd7h is being synchronized. 14 segd6h 0 r segd6h register busy set when the value written to segd6h is being synchronized. 13 segd5h 0 r segd5h register busy set when the value written to segd5h is being synchronized. 12 segd4h 0 r segd4h register busy set when the value written to segd4h is being synchronized.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 809 www.energymicro.com bit name reset access description 11 segd3h 0 r segd3h register busy set when the value written to segd3h is being synchronized. 10 segd2h 0 r segd2h register busy set when the value written to segd2h is being synchronized. 9 segd1h 0 r segd1h register busy set when the value written to segd1h is being synchronized. 8 segd0h 0 r segd0h register busy set when the value written to segd0h is being synchronized. 7 segd3l 0 r segd3l register busy set when the value written to segd3l is being synchronized. 6 segd2l 0 r segd2l register busy set when the value written to segd2l is being synchronized. 5 segd1l 0 r segd1l register busy set when the value written to segd1l is being synchronized. 4 segd0l 0 r segd0l register busy set when the value written to segd0l is being synchronized. 3 aregb 0 r aregb register busy set when the value written to aregb is being synchronized. 2 arega 0 r arega register busy set when the value written to arega is being synchronized. 1 bactrl 0 r bactrl register busy set when the value written to bactrl is being synchronized. 0 ctrl 0 r ctrl register busy set when the value written to ctrl is being synchronized. 33.5.22 lcd_segd4h - segment data high register 4 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x0b4 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name segd4h bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 segd4h 0x00 rw com0 segment data high this register contains segment data for segment lines 32-39 for com0. 33.5.23 lcd_segd5h - segment data high register 5 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 810 www.energymicro.com offset bit position 0x0b8 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name segd5h bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 segd5h 0x00 rw com1 segment data high this register contains segment data for segment lines 32-39 for com1. 33.5.24 lcd_segd6h - segment data high register 6 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x0bc 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name segd6h bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 7:0 segd6h 0x00 rw com2 segment data high this register contains segment data for segment lines 32-39 for com2. 33.5.25 lcd_segd7h - segment data high register 7 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x0c0 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00 access rw name segd7h bit name reset access description 31:8 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 )
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 811 www.energymicro.com bit name reset access description 7:0 segd7h 0x00 rw com3 segment data high this register contains segment data for segment lines 32-39 for com3. 33.5.26 lcd_segd4l - segment data low register 4 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x0cc 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name segd4l bit name reset access description 31:0 segd4l 0x00000000 rw com4 segment data this register contains segment data for segment lines 0-23 for com4. 33.5.27 lcd_segd5l - segment data low register 5 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x0d0 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name segd5l bit name reset access description 31:0 segd5l 0x00000000 rw com5 segment data this register contains segment data for segment lines 0-23 for com5. 33.5.28 lcd_segd6l - segment data low register 6 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) .
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 812 www.energymicro.com offset bit position 0x0d4 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name segd6l bit name reset access description 31:0 segd6l 0x00000000 rw com6 segment data this register contains segment data for segment lines 0-23 for com6. 33.5.29 lcd_segd7l - segment data low register 7 (async reg) for more information about asynchronous registers please see section 5.3 (p. 21 ) . offset bit position 0x0d8 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0x00000000 access rw name segd7l bit name reset access description 31:0 segd7l 0x00000000 rw com7 segment data this register contains segment data for segment lines 0-23 for com7.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 813 www.energymicro.com 34 fpueh - floating point unit exception handler 0 1 2 3 4 float ing-point unit except ion irq arm cort ex-m4 fpu except ion handler quick facts what? fpu exception handler allows user defined handling of fpu exceptions. why? proper handling of exceptions is crucial in many applications. how? the fpu exception handler monitors status flags from the fpu and issues an interrupt when exceptions occur. 34.1 functional description the floating point unit, fpu, included in the cortex-m4 has a set of status flags indicating mathematical errors that cause floating-point exceptions. available status flags are: ? fpioc - fpu invalid operation. ? fpdzc - fpu divide-by-zero exception. ? fpufc - fpu underflow exception. ? fpofc - fpu overflow exception. ? fpidc - fpu input denormal exception. ? fpixc - fpu inexact exception. refer to the efm32 cortex-m4 reference manual for more information about the fpu status flags. the fpu exception handler, fpueh, monitors these status flags and sets the corresponding interrupt flag in fpueh_if when they are asserted. an interrupt request will be set if the corresponding bit in fpueh_ien is set. the interrupt flags can also be set and cleared using the fpueh_ifs and fpueh_ifc registers, respectively. note before the fpueh interrupt flags can be cleared, the corresponding status flag in the fpu has to be cleared. refer to efm32 cortex-m4 reference manual for information on how to do this.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 814 www.energymicro.com 34.2 register map the offset register address is relative to the registers base address. offset name type description 0x000 fpueh_if r interrupt flag register 0x004 fpueh_ifs w1 interrupt flag set register 0x008 fpueh_ifc w1 interrupt flag clear register 0x00c fpueh_ien rw interrupt enable register 34.3 register description 34.3.1 fpueh_if - interrupt flag register offset bit position 0x000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access r r r r r r name fpixc fpidc fpofc fpufc fpdzc fpioc bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 fpixc 0 r fpu inexact exception set upon fpu inexact exception 4 fpidc 0 r fpu input denormal exception set upon fpu input denormal exception 3 fpofc 0 r fpu overflow exception set upon fpu overflow exception 2 fpufc 0 r fpu underflow exception set upon fpu underflow exception 1 fpdzc 0 r fpu divide-by-zero exception set upon fpu divide-by-zero exception 0 fpioc 0 r fpu invalid operation set upon fpu invalid operation 34.3.2 fpueh_ifs - interrupt flag set register offset bit position 0x004 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 name fpixc fpidc fpofc fpufc fpdzc fpioc
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 815 www.energymicro.com bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 fpixc 0 w1 set fpixc interrupt flag write 1 to set the fpixc interrupt flag 4 fpidc 0 w1 set fpidc interrupt flag write 1 to set the fpidc interrupt flag 3 fpofc 0 w1 set fpofc interrupt flag write 1 to set the fpofc interrupt flag 2 fpufc 0 w1 set fpufc interrupt flag write 1 to set the fpufc interrupt flag 1 fpdzc 0 w1 set fpdzc interrupt flag write 1 to set the fpdzc interrupt flag 0 fpioc 0 w1 set fpioc interrupt flag write 1 to set the fpioc interrupt flag 34.3.3 fpueh_ifc - interrupt flag clear register offset bit position 0x008 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access w1 w1 w1 w1 w1 w1 name fpixc fpidc fpofc fpufc fpdzc fpioc bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 fpixc 0 w1 clear fpixc interrupt flag write 1 to clear the fpixc interrupt flag 4 fpidc 0 w1 clear fpidc interrupt flag write 1 to clear the fpidc interrupt flag 3 fpofc 0 w1 clear fpofc interrupt flag write 1 to clear the fpofc interrupt flag 2 fpufc 0 w1 clear fpufc interrupt flag write 1 to clear the fpufc interrupt flag 1 fpdzc 0 w1 clear fpdzc interrupt flag write 1 to clear the fpdzc interrupt flag 0 fpioc 0 w1 clear fpioc interrupt flag write 1 to clear the fpioc interrupt flag
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 816 www.energymicro.com 34.3.4 fpueh_ien - interrupt enable register offset bit position 0x00c 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reset 0 0 0 0 0 0 access rw rw rw rw rw rw name fpixc fpidc fpofc fpufc fpdzc fpioc bit name reset access description 31:6 reserved to ensure compatibility with future devices, always write bits to 0. more information in section 2.1 (p. 3 ) 5 fpixc 0 rw fpixc interrupt enable enable/disable the fpixc interrupt 4 fpidc 0 rw fpidc interrupt enable enable/disable the fpidc interrupt 3 fpofc 0 rw fpofc interrupt enable enable/disable the fpofc interrupt 2 fpufc 0 rw fpufc interrupt enable enable/disable the fpufc interrupt 1 fpdzc 0 rw fpdzc interrupt enable enable/disable the fpdzc interrupt 0 fpioc 0 rw fpioc interrupt enable enable/disable the fpioc interrupt
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 817 www.energymicro.com 35 revision history 35.1 revision 0.50 may 8th, 2013 initial preliminary revision
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 818 www.energymicro.com a abbreviations a.1 abbreviations this section lists abbreviations used in this document. table a.1. abbreviations abbreviation description acmp analog comparator adc analog to digital converter ahb amba advanced high-performance bus. amba is short for "advanced microcontroller bus architecture". apb amba advanced peripheral bus. amba is short for "advanced microcontroller bus architecture". ale address latch enable auxhfrco auxiliary high frequency rc oscillator. cc compare / capture clk clock cmd command cmu clock management unit ctrl control dac digital to analog converter dbg debug dma direct memory access drd dual role device dti dead time insertion ebi external bus interface efm energy friendly microcontroller em energy mode em0 energy mode 0 (also called active mode) em1 to em4 energy mode 1 to energy mode 4 (also called low energy modes) emu energy management unit enob effective number of bits fs full-speed gpio general purpose input / output hfrco high frequency rc oscillator hfxo high frequency crystal oscillator hw hardware i 2 c inter-integrated circuit interface lcd liquid crystal display lesense low energy sensor interface
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 819 www.energymicro.com abbreviation description letimer low energy timer leuart low energy universal asynchronous receiver transmitter lfrco low frequency rc oscillator lfxo low frequency crystal oscillator ls low-speed mac media access controller nvic nested vector interrupt controller opa/opamp operational amplifier osr oversampling ratio otg on-the-go pcnt pulse counter pga programmable gain array phy physical layer prs peripheral reflex system psrr power supply rejection ratio pwm pulse width modulation rc resistance and capacitance rmu reset management unit rtc real time clock sar successive approximation register sof start of frame spi serial peripheral interface sw software thd total harmonic distortion uart universal asynchronous receiver transmitter usart universal synchronous asynchronous receiver transmitter usb universal serial bus vcmp voltage supply comparator wdog watchdog timer xtal crystal
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 820 www.energymicro.com b disclaimer and trademarks b.1 disclaimer energy micro as intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or intending to use the energy micro products. characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "typical" parameters provided can and do vary in different applications. application examples described herein are for illustrative purposes only. energy micro reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included information. energy micro shall have no liability for the consequences of use of the information supplied herein. this document does not imply or express copyright licenses granted hereunder to design or fabricate any integrated circuits. the products must not be used within any life support system without the specific written consent of energy micro. a "life support system" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected to result in significant personal injury or death. energy micro products are generally not intended for military applications. energy micro products shall under no circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons. b.2 trademark information energy micro, efm32, efr, logo and combinations thereof, and others are the registered trademarks or trademarks of energy micro as. arm, cortex, thumb are the registered trademarks of arm limited. other terms and product names may be trademarks of others.
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 821 www.energymicro.com c contact information c.1 energy micro corporate headquarters postal address visitor address technical support energy micro as p.o. box 4633 nydalen n-0405 oslo norway energy micro as sandakerveien 118 n-0484 oslo norway support.energymicro.com phone: +47 40 10 03 01 www.energymicro.com phone: +47 23 00 98 00 fax: + 47 23 00 98 01 c.2 global contacts visit www.energymicro.com for information on global distributors and representatives or contact sales@energymicro.com for additional information. americas europe, middle east and africa asia and pacific www.energymicro.com/americas www.energymicro.com/emea www.energymicro.com/asia
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 822 www.energymicro.com table of contents 1. energy friendly microcontrollers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. typical applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2. EFM32WG development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2. about this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1. conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2. related documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. system overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.3. block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.4. energy modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.5. product overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4. system processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 5. memory and bus system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5.2. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.3. access to low energy peripherals (asynchronous registers) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5.4. flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 5.5. sram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 5.6. device information (di) page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 6. dbg - debug interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.4. debug lock and device erase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.5. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 6.6. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 7. msc - memory system controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 7.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 7.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 7.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 7.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 7.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 8. dma - dma controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 8.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 8.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 8.3. block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 8.4. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 8.5. examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 8.6. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 8.7. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 9. rmu - reset management unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 9.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 9.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 9.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 9.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 9.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 10. emu - energy management unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 10.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 10.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 11. cmu - clock management unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 11.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 11.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 11.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 11.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 11.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 12. wdog - watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 12.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 12.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 12.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 12.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 12.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 13. prs - peripheral reflex system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 13.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 13.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 823 www.energymicro.com 13.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 13.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 13.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 14. ebi - external bus interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 14.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 14.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 14.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 14.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 14.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 15. usb - universal serial bus controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 15.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 15.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 15.3. usb system description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 15.4. usb core description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 15.5. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 15.6. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 16. i 2 c - inter-integrated circuit interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 16.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 16.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 16.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 16.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 16.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 17. usart - universal synchronous asynchronous receiver/transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 17.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 17.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 17.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 17.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 17.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 18. uart - universal asynchronous receiver/transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 18.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 18.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 18.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 18.4. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 18.5. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 19. leuart - low energy universal asynchronous receiver/transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 19.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 19.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 19.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 19.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 19.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 20. timer - timer/counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 20.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 20.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 20.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 20.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 20.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538 21. rtc - real time counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 21.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 21.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 21.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 21.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560 21.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560 22. burtc - backup real time counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 22.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 22.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 22.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 22.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 22.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 23. letimer - low energy timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579 23.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579 23.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579 23.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 23.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 23.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 24. pcnt - pulse counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 24.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 24.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 24.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 24.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 24.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 25. lesense - low energy sensor interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 25.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 25.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 25.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 824 www.energymicro.com 25.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 25.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632 26. acmp - analog comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661 26.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661 26.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661 26.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662 26.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 26.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 27. vcmp - voltage comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 27.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 27.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 27.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 27.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 27.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 28. adc - analog to digital converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 28.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 28.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 28.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 28.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 28.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 29. dac - digital to analog converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704 29.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704 29.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704 29.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 29.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 29.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 30. opamp - operational amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 30.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 30.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 30.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 30.4. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 30.5. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 31. aes - advanced encryption standard accelerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 31.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 31.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 31.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 31.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740 31.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740 32. gpio - general purpose input/output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 32.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 32.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 32.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749 32.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756 32.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757 33. lcd - liquid crystal display driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774 33.1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774 33.2. features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774 33.3. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775 33.4. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797 33.5. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797 34. fpueh - floating point unit exception handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813 34.1. functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813 34.2. register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814 34.3. register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814 35. revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817 35.1. revision 0.50 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817 a. abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818 a.1. abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818 b. disclaimer and trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820 b.1. disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820 b.2. trademark information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820 c. contact information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821 c.1. energy micro corporate headquarters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821 c.2. global contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 825 www.energymicro.com list of figures 3.1. block diagram of EFM32WG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2. energy mode indicator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.1. interrupt operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 5.1. EFM32WG bus system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.2. system address space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.3. write operation to low energy peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.4. read operation from low energy peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 6.1. aap - authentication access port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.2. device unlock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 6.3. aap expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 7.1. revision number extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 7.2. instruction cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8.1. dma block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 8.2. polling flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 8.3. ping-pong example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 8.4. memory scatter-gather example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 8.5. peripheral scatter-gather example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 8.6. memory map for 12 channels, including the alternate data structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 8.7. detailed memory map for the 12 channels, including the alternate data structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 8.8. channel_cfg bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 8.9. 2d copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 9.1. rmu reset input sources and connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 9.2. rmu power-on reset operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 9.3. rmu brown-out detector operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 10.1. emu overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 10.2. emu energy mode transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 10.3. backup power domain overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 10.4. entering and leaving backup mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 10.5. bod calibration using dac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 11.1. cmu overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 11.2. cmu switching from hfrco to hfxo before hfxo is ready . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 11.3. cmu switching from hfrco to hfxo after hfxo is ready . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 11.4. hfxo pin connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 11.5. lfxo pin connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 11.6. hw-support for rc oscillator calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 11.7. single calibration (cont=0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 11.8. continuous calibration (cont=1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 13.1. prs overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 13.2. timer0 overflow starting adc0 single conversions through prs channel 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 14.1. ebi overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 14.2. ebi non-multiplexed 8-bit data, 8-bit address read operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 14.3. ebi non-multiplexed 8-bit data, 8-bit address write operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 14.4. ebi address latch setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 14.5. ebi multiplexed 16-bit data, 16-bit address read operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 14.6. ebi multiplexed 16-bit data, 16-bit address write operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 14.7. ebi multiplexed 8-bit data, 24-bit address read operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 14.8. ebi multiplexed 8-bit data, 24-bit address write operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 14.9. ebi non-multiplexed 16-bit data read operation with extended address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 14.10. ebi non-multiplexed 16-bit data write operation with extended address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 14.11. ebi page mode read operation for d8a8 addressing mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 14.12. ebi page mode read operation for d16a16ale addressing mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 14.13. ebi page mode read operation for d8a24ale addressing mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 14.14. ebi page mode read operation for d16 addressing mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 14.15. ebi page closing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 14.16. ebi extended address latch setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 14.17. ebi 16-bit data multiplexed read operation using extended addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 14.18. ebi 16-bit data multiplexed write operation using extended addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 14.19. ebi multiplexed read operation with reduced length strobes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 14.20. ebi multiplexed write operation with reduced length strobes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 14.21. ebi enforced idle cycles between transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 14.22. ebi no enforced idle cycles between transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 14.23. ebi default memory map (altmap = 0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 14.24. ebi alternative memory map (altmap = 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 14.25. ebi connection with standard nand flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 14.26. ebi connection with chip enable don't care nand flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 14.27. ebi nand flash command latch timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 14.28. ebi nand flash address latch timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 14.29. ebi nand flash data input timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 14.30. ebi nand flash data output timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 14.31. ebi ecc generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 14.32. ebi ebi_eccparity format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 826 www.energymicro.com 14.33. ebi tft size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 14.34. ebi tft direct drive from internal memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 14.35. ebi tft direct drive from external memory (non-multiplexed address/data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 14.36. ebi tft direct drive from external memory (multiplexed address/data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 14.37. ebi direct drive address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 14.38. ebi tft alpha blending and masking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 14.39. ebi tft pixel timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 14.40. ebi tft direct drive internal timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 14.41. ebi tft direct drive external timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 14.42. ebi tft horizontal porch timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 14.43. ebi tft vertical porch timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 14.44. ebi tft pixel timing: ebi_dclk driven off positive edge internal clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 14.45. ebi tft pixel timing: ebi_dclk driven off negative edge internal clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 14.46. ebi tft interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 15.1. usb block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 15.2. bus-powered device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 15.3. self-powered device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 15.4. self-powered device (with bus-power switch) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 15.5. otg dual role device (5v) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 15.6. otg dual role device (5v step-up regulator) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 15.7. host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 15.8. transmit transaction-level operation in slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 15.9. receive transaction-level operation in slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 15.10. transmit fifo write task in slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 15.11. receive fifo read task in slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 15.12. normal bulk/control out/setup and bulk/control in transactions in slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 15.13. normal bulk/control out/setup and bulk/control in transactions in dma mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 15.14. interrupt service routine for bulk/control out transaction in dma mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 15.15. normal interrupt out/in transactions in slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 15.16. normal interrupt out/in transactions in dma mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 15.17. normal isochronous out/in transactions in slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 15.18. normal isochronous out/in transactions in dma mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 15.19. processing a setup packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 15.20. two-stage control transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 15.21. receive fifo packet read in slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 15.22. slave mode bulk out transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 15.23. isoc out application flow for periodic transfer interrupt feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 15.24. isochronous out core internal flow for periodic transfer interrupt feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 15.25. bulk in stall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 15.26. usbtrdtim max timing case error wrong image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 15.27. slave mode bulk in transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 15.28. slave mode bulk in transfer (pipelined transaction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 15.29. slave mode bulk in two-endpoint transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 15.30. periodic in application flow for periodic transfer interrupt feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 15.31. periodic in core internal flow for periodic transfer interrupt feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 15.32. srp detection by core when operating as a-device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 15.33. srp initiation by the core when acting as a b-device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 15.34. hnp when the core is an a-device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 15.35. hnp when the core is a b-device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 15.36. core interrupt handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 16.1. i 2 c overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 16.2. i 2 c-bus example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 16.3. i 2 c start and stop conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 16.4. i 2 c bit transfer on i 2 c-bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 16.5. i 2 c single byte write to slave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 16.6. i 2 c double byte read from slave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 16.7. i 2 c single byte write, then repeated start and single byte read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 16.8. i 2 c master transmitter/slave receiver with 10-bit address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 16.9. i 2 c master receiver/slave transmitter with 10-bit address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 16.10. i 2 c master state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 16.11. i 2 c slave state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 17.1. usart overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 17.2. usart asynchronous frame format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 17.3. usart transmit buffer operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 17.4. usart receive buffer operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453 17.5. usart sampling of start and data bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 17.6. usart sampling of stop bits when number of stop bits are 1 or more . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 17.7. usart local loopback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 17.8. usart half duplex communication with external driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 17.9. usart transmission of large frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 17.10. usart transmission of large frames, msbf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 17.11. usart reception of large frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 17.12. usart iso 7816 data frame without error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 17.13. usart iso 7816 data frame with error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 827 www.energymicro.com 17.14. usart smartcard stop bit sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 17.15. usart spi timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 17.16. usart spi timing with smsdelay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 17.17. usart spi slave timing with sssearly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 17.18. usart standard i2s waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 17.19. usart standard i2s waveform (reduced accuracy) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 17.20. usart left-justified i2s waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 17.21. usart right-justified i2s waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 17.22. usart mono i2s waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 17.23. usart example rzi signal for a given asynchronous usart frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 19.1. leuart overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 19.2. leuart asynchronous frame format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 19.3. leuart transmitter overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 19.4. leuart receiver overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 19.5. leuart local loopback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 19.6. leuart half duplex communication with external driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 19.7. leuart - nrz vs. rzi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504 20.1. timer block overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 20.2. timer hardware timer/counter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 20.3. timer clock selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 20.4. timer connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 20.5. timer top value update functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 20.6. timer quadrature encoded inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 20.7. timer quadrature decoder configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 20.8. timer x2 decoding mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 20.9. timer x4 decoding mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 20.10. timer input pin logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526 20.11. timer input capture buffer functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526 20.12. timer output compare/pwm buffer functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527 20.13. timer input capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527 20.14. timer period and/or pulse width capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 20.15. timer block diagram showing comparison functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 20.16. timer output logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 20.17. timer up-count frequency generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 20.18. timer up-count pwm generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 20.19. timer cc out in 2x mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 20.20. timer up/down-count pwm generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 20.21. timer cc out in 2x mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 20.22. timer dead-time insertion unit overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 20.23. timer triple half-bridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 20.24. timer overview of dead-time insertion block for a single pwm channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 20.25. timer polarity of both signals are set as active-high . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 20.26. timer output polarities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534 21.1. rtc overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 22.1. burtc overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 23.1. letimer overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 23.2. letimer state machine for free-running mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 23.3. letimer one-shot repeat state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583 23.4. letimer buffered repeat state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 23.5. letimer double repeat state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 23.6. letimer simple waveforms output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587 23.7. letimer repeated counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587 23.8. letimer dual output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587 23.9. letimer triggered operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 23.10. letimer continuous operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 23.11. letimer letimern_cnt not initialized to 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 24.1. pcnt overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602 24.2. pcnt quadrature coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 24.3. pcnt direction change interrupt (dircng) generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 25.1. lesense block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617 25.2. scan sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619 25.3. timing diagram, short excitation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619 25.4. pin sequencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621 25.5. scan result and interrupt generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622 25.6. sensor scan and decode sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622 25.7. decoder state transition evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 25.8. decoder hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 25.9. circular result buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625 25.10. capacitive sense setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627 25.11. lc sensor setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627 25.12. lc sensor oscillations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628 25.13. fsm example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628 25.14. fsm example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 26.1. acmp overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 828 www.energymicro.com 26.2. 20 mv hysteresis selected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 664 26.3. capacitive sensing set-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665 27.1. vcmp overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 27.2. vcmp 20 mv hysteresis enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674 28.1. adc overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 28.2. adc conversion timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683 28.3. adc analog power consumption with different warmupmode settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684 28.4. adc rc input filter configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684 28.5. adc bias programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686 28.6. adc conversion tailgating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687 29.1. dac overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 29.2. dac bias programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 29.3. dac sine mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708 30.1. opamp system overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 30.2. opamp overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 30.3. opamp output stage overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 30.4. voltage follower unity gain overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 30.5. inverting input pga overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730 30.6. non-inverting pga overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730 30.7. cascaded inverting pga overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 30.8. cascaded non-inverting pga overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 30.9. two op-amp differential amplifier overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 30.10. three op-amp differential amplifier overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 30.11. dual buffer adc driver overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 31.1. aes key and data definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 31.2. aes data and key orientation as defined in the advanced encryption standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 31.3. aes data and key register operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738 32.1. pin configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750 32.2. tristated output with optional pull-up or pull-down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751 32.3. push-pull configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752 32.4. open-drain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752 32.5. em4 wake-up logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753 32.6. pin n interrupt generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754 33.1. lcd block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775 33.2. lcd low-power waveform for lcd_com0 in quadruples multiplex mode, 1/3 bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777 33.3. lcd normal waveform for lcd_com0 in quadruples multiplex mode, 1/3 bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777 33.4. lcd static bias and multiplexing - lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777 33.5. lcd 1/2 bias and duplex multiplexing - lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778 33.6. lcd 1/2 bias and duplex multiplexing - lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778 33.7. lcd 1/2 bias and duplex multiplexing - lcd_seg0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778 33.8. lcd 1/2 bias and duplex multiplexing - lcd_seg0 connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778 33.9. lcd 1/2 bias and duplex multiplexing - lcd_seg0-lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779 33.10. lcd 1/2 bias and duplex multiplexing - lcd_seg0-lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779 33.11. lcd 1/3 bias and duplex multiplexing - lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779 33.12. lcd 1/3 bias and duplex multiplexing - lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779 33.13. lcd 1/3 bias and duplex multiplexing - lcd_seg0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780 33.14. lcd 1/3 bias and duplex multiplexing - lcd_seg0 connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780 33.15. lcd 1/3 bias and duplex multiplexing - lcd_seg0-lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780 33.16. lcd 1/3 bias and duplex multiplexing - lcd_seg0-lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781 33.17. lcd 1/2 bias and triplex multiplexing - lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781 33.18. lcd 1/2 bias and triplex multiplexing - lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781 33.19. lcd 1/2 bias and triplex multiplexing - lcd_com2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781 33.20. lcd 1/2 bias and triplex multiplexing - lcd_seg0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782 33.21. lcd 1/2 bias and triplex multiplexing - lcd_seg0 connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782 33.22. lcd 1/2 bias and triplex multiplexing - lcd_seg0-lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782 33.23. lcd 1/2 bias and triplex multiplexing - lcd_seg0-lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782 33.24. lcd 1/2 bias and triplex multiplexing - lcd_seg0-lcd_com2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783 33.25. lcd 1/3 bias and triplex multiplexing - lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783 33.26. lcd 1/3 bias and triplex multiplexing - lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783 33.27. lcd 1/3 bias and triplex multiplexing - lcd_com2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783 33.28. lcd 1/3 bias and triplex multiplexing - lcd_seg0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 784 33.29. lcd 1/3 bias and triplex multiplexing - lcd_seg0 connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 784 33.30. lcd 1/3 bias and triplex multiplexing - lcd_seg0-lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 784 33.31. lcd 1/3 bias and triplex multiplexing - lcd_seg0-lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 784 33.32. lcd 1/3 bias and triplex multiplexing - lcd_seg0-lcd_com2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 33.33. lcd 1/3 bias and quadruplex multiplexing - lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 33.34. lcd 1/3 bias and quadruplex multiplexing - lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 33.35. lcd 1/3 bias and quadruplex multiplexing - lcd_com2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 33.36. lcd 1/3 bias and quadruplex multiplexing - lcd_com3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786 33.37. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786 33.38. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0 connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786 33.39. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786 33.40. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787 33.41. lcd 1/3 bias and quadruplex multiplexing - lcd_seg0-lcd_com2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 829 www.energymicro.com 33.42. lcd 1/3 bias and quadruplex multiplexing- lcd_seg0-lcd_com3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787 33.43. lcd clock system in lcd driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793 33.44. lcd block diagram of the animation circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 830 www.energymicro.com list of tables 2.1. register access types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1. energy mode description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.2. EFM32WG microcontroller series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.1. interrupt request lines (irq) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 5.1. memory system core peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.2. memory system low energy peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.3. memory system peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 5.4. device information page contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 7.1. msc flash memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 7.2. lock bits page structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 7.3. revision number interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 8.1. ahb bus transfer arbitration interval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 8.2. dma channel priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 8.3. dma cycle types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 8.4. channel_cfg for a primary data structure, in memory scatter-gather mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 8.5. channel_cfg for a primary data structure, in peripheral scatter-gather mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 8.6. address bit settings for the channel control data structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 8.7. src_data_end_ptr bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 8.8. dst_data_end_ptr bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 8.9. channel_cfg bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 8.10. dma cycle of six words using a word increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 8.11. dma cycle of 12 bytes using a halfword increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 8.12. user data assignments when descrect is set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 9.1. rmu reset cause register interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 10.1. emu energy mode overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 10.2. emu entering a low energy mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 10.3. emu wakeup triggers from low energy modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 11.1. configuration for operating frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 13.1. reflex producers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 13.2. reflex consumers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 14.1. ebi intrapage hit condition for read on address addr (non-mentioned addr bits are unchanged) . . . . . . . . . . . . . . . . . . . . . . . . . 179 14.2. ebi enabling ebi_addr lines for transaction with address addr and data data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 14.3. ebi mapping of ahb transactions to external device transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 14.4. ebi nand flash register select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 14.5. ebi nand flash write timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 14.6. ebi nand flash read timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 14.7. ebi nand flash read/write timing requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 14.8. ebi ecc bit/column parity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 14.9. ebi ecc byte/row parity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 14.10. ebi ebi_eccparity valid bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 14.11. ebi error detection result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 15.1. host programming operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 15.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 15.3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 15.4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 16.1. i 2 c reserved i 2 c addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 16.2. i 2 c clock mode examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 16.3. i 2 c interactions in prioritized order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 16.4. i 2 c master transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 16.5. i 2 c master receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 16.6. i 2 c state values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 16.7. i 2 c transmission status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 16.8. i 2 c slave transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 16.9. i 2 c - slave receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 16.10. i 2 c bus error response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 17.1. usart asynchronous vs. synchronous mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 17.2. usart pin usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 17.3. usart data bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 17.4. usart stop bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 17.5. usart parity bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 17.6. usart oversampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 17.7. usart baud rates @ 4mhz peripheral clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 17.8. usart spi modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 17.9. usart i2s modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 17.10. usart irda pulse widths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 18.1. uart limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 19.1. leuart parity bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 19.2. leuart baud rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 20.1. timer counter response in x2 decoding mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 20.2. timer counter response in x4 decoding mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 20.3. timer events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 831 www.energymicro.com 21.1. rtc resolution vs overflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558 22.1. resolution and overflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567 23.1. letimer repeat modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 23.2. letimer underflow output actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586 24.1. pcnt quad mode counter control function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 25.1. lesense scan configuration selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618 25.2. lesense excitation pin mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620 25.3. lesense decoder configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 25.4. lesense decoder configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630 26.1. bias configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663 27.1. bias configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 28.1. adc single ended conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687 28.2. adc differential conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688 28.3. oversampling result shifting and resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688 28.4. adc results representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689 28.5. calibration register effect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 30.1. general opamp mode configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 30.2. voltage follower unity gain configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 30.3. inverting input pga configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730 30.4. non-inverting pga configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730 30.5. cascaded inverting pga configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 30.6. cascaded non-inverting pga configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 30.7. opa0/opa1 differential amplifier configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 30.8. opa1/opa2 differential amplifier configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 30.9. three opamp differential amplifier gain programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 30.10. three opamp differential amplifier configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 30.11. dual buffer adc driver configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 32.1. pin configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750 32.2. em4 wu register bits to pin mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753 33.1. lcd mux settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776 33.2. lcd bias settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776 33.3. lcd wave settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777 33.4. lcd contrast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788 33.5. lcd contrast function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788 33.6. lcd principle of contrast adjustment for different bias settings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789 33.7. lcd v lcd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790 33.8. lcd v boost frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790 33.9. lcd frame rate conversion table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791 33.10. lcd update data control (udctrl) bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791 33.11. dsc bias encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792 33.12. fcpresc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792 33.13. lcd animation shift register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794 33.14. lcd animation pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794 33.15. lcd animation example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795 a.1. abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 832 www.energymicro.com list of examples 8.1. dma transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 17.1. usart multi-processor mode example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 20.1. timer dti example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 20.2. timer dti example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534 23.1. letimer triggered output generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 23.2. letimer continuous output generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 23.3. letimer pwm output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 23.4. letimer pwm output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 31.1. aes cipher block chaining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739 32.1. interrupt example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755 33.1. lcd event frequency example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793 33.2. lcd animation enable example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796 33.3. lcd animation dependence example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796
...the world's most energy friendly microcontrollers 2013-05-08 - wonder gecko family - d0233_rev0.50 833 www.energymicro.com list of equations 5.1. memory sram area set/clear bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.2. memory peripheral area bit modification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.3. memory wait cycles with clock equal or faster than hfcoreclk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5.4. memory wait cycles with clock slower than cpu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 12.1. wdog timeout equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 14.1. ebi tft total width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 14.2. ebi tft total height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 14.3. ebi alpha blending equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 14.4. ebi in-place alpha blending into external memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 14.5. ebi alpha blending into external memory with background color1 from register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 14.6. ebi internal alpha blending from registers into register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 16.1. i 2 c pull-up resistor equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 16.2. i 2 c maximum transmission rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 16.3. i 2 c high and low cycles equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 17.1. usart baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 17.2. usart desired baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 17.3. usart synchronous mode bit rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 17.4. usart synchronous mode clock division factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 19.1. leuart baud rate equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 19.2. leuart clkdiv equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 19.3. leuart optimal sampling point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 19.4. leuart actual sampling point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 20.1. timer rotational position equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 20.2. timer up-count frequency generation equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 20.3. timer up-count pwm resolution equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 20.4. timer up-count pwm frequency equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 20.5. timer up-count duty cycle equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 20.6. timer 2x pwm resolution equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 20.7. timer 2x mode pwm frequency equation( up-count) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 20.8. timer 2x mode duty cycle equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 20.9. timer up/down-count pwm resolution equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 20.10. timer up/down-count pwm frequency equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 20.11. timer up/down-count duty cycle equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 20.12. timer 2x pwm resolution equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 20.13. timer 2x mode pwm frequency equation( up/down-count) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 20.14. timer 2x mode duty cycle equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 21.1. rtc frequency equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 22.1. burtc frequency equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 22.2. low power mode compare match resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567 23.1. letimer clock frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 24.1. absolute position with hysteresis and even top value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 24.2. absolute position with hysteresis and odd top value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 25.1. scan frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619 26.1. v dd scaled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 664 27.1. vcmp v dd trigger level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674 28.1. adc total conversion time (in adc_clk cycles) per output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 28.2. adc temperature measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685 29.1. dac clock prescaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 29.2. dac single ended output voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 29.3. dac differential output voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 29.4. dac sine generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708 33.1. lcd frame rate calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791 33.2. lcd event frequency equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792


▲Up To Search▲   

 
Price & Availability of EFM32WG

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X